147k views
5 votes
12) Consider following schema Employee (E_id, E_name, Salary, Department) Write SQL commands for following statement.

i. Find Summation of salary for all employees.
ii. Display Minimum and Maximum Salary.
iii. Display all record in descending order of Employee name.
iv. Display employee name working in department “Quality




\:

Don't Spam ∼
Thank uh!:)​

1 Answer

3 votes


\underline{ \textsf \purple{ \: Employee table : - \: }}


\begin{array} c  \hline\ \ \text{ \sf \red{eid} \: }& \text{ \sf \red{ename}} \text{ }& \text{ \sf \red{ \: Salary} }\text{ \:}& \text{ \sf \red{Department} }\\ \hline \sf{101}& \sf{shreyas}& \sf{53000}& \sf{president} \\ \hline \sf{102}& \sf{geeta}& \sf{2850}& \sf{manager} \\ \hline \sf{103}& \sf{suhas}& \sf{3000} & \sf{analyst} \\ \hline \sf{104}& \sf{meena}& \sf{2590}& \sf{manager}\\ \hline\end{array}

━━━━━━━━━━━━━━━━━━━━━━━

i ]


\textsf \color{green}{↪ select sum salary from Employee;}


\:


\:

━━━━━━━━━━━━━━━━━━━━━━━

ii ]


\underline{ \textsf \color{brown}{ \: For maximum salary: \: }}


\textsf \blue{↪ select max( salary ) from Employee;}


\begin{array} c \hline\ \ \text{ \sf \red{eid} }& \text{ \sf \red{ename}} \text{ }& \text{ \sf \red{Salary} }\text{ \:}& \text{ \sf \red{Department} }\\ \hline \sf{101}& \sf{shreyas}& \sf{53000}& \sf{president} \\ \hline\end{array}


\:

━━━━━━━━━━━━━━━━━━━━━━━


\:


\underline{ \textsf \color{hotpink}{ \:For minimum salary : \: }}


\textsf \orange{↪select min( salary ) from Employee;}


\: \begin{array} c \hline\ \ \text{ \sf \red{eid} }& \text{ \sf \red{ename}} \text{ }& \text{ \sf \red{salary} }\text{ \:}& \text{ \sf \red{department} }\\ \hline \sf{104}& \sf{meena}& \sf{2590}& \sf{manager}\\ \hline\end{array}


\:

━━━━━━━━━━━━━━━━━━━━━━━

iii ]


\textsf \color{cyan}{↪ SELECT * from Employee ORDER BY ename desc ;}


\begin{array} c \hline\ \ \text{ \sf \red{eid} }& \text{ \sf \red{ename}} \text{ }& \text{ \sf \red{salary} }\text{ \:}& \text{ \sf \red{department} }\\ \hline \sf{101}& \sf{shreyas}& \sf{53000}& \sf{president} \\ \hline \sf{103}& \sf{suhas}& \sf{3000} & \sf{analyst} \\ \hline \sf{104}& \sf{meena}& \sf{2590}& \sf{manager}\\ \hline \sf{102}& \sf{geeta}& \sf{2850}& \sf{manager} \\ \hline\end{array}


\:

━━━━━━━━━━━━━━━━━━━━━━━

iv ]


\textsf \color{blue}{↪ ALTER ename as 'Quality';}


\:


\:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

hope it helps ⸙

User Bob Brinks
by
7.3k points