Consider the table DOCTOR given below. Write commands in SQL for (i) to (iv) and output for (v) to (vii).
Table: DOCTOR
Attachments:
Answers
Answered by
16
(i) To display the names and date of joining of doctors of the oncology department.
- Select DocName, DOJ from Doctor where Department = 'Oncology';
(ii) To display the names and salaries of doctors in descending order of salaries.
- Select DocName, Salary from Doctor order by Salary desc;
(iii) To display the names and salaries of all the female doctors whose salaries are above 50000.
- Select DocName, Salary from Doctor where Gender = 'F' and Salary > 50000;
(iv) To display the names of each department along with the total salary being given to the doctors of that department.
- Select Department, Sum(Salary) from Doctor group by Department;
(v) Output for: Select Department from Doctor where Department = 'Surgery';
(vi) Output for: Select Sum(Salary) from Doctor where Department = 'Surgery';
(vii) Output for: Select DocName, Gender, Department from Doctor where DocName like 'J%';
Similar questions