The document provides tables for doctors and salaries and instructions to write SQL queries on them. The queries are:
1) Display names of doctors in the Medicine department with over 10 years experience
2) Calculate average salary of doctors in the ENT department
3) Find minimum allowance of female doctors
4) Count number of female doctors
5) Display name, department, and basic salary of doctors in the ENT department matching IDs
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
580 views2 pages
Q21 SQL (Doctor&SAlary)
The document provides tables for doctors and salaries and instructions to write SQL queries on them. The queries are:
1) Display names of doctors in the Medicine department with over 10 years experience
2) Calculate average salary of doctors in the ENT department
3) Find minimum allowance of female doctors
4) Count number of female doctors
5) Display name, department, and basic salary of doctors in the ENT department matching IDs
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
Q.
21 Study the following table DOCTOR and SALARY and write SQL as per instructed. Table:-DOCTOR
ID NAME DEPT SEX EXPERIENCE
101 John ENT M 12 104 Smith ORTHOPEDIC M 5 107 George CARDIOLOGY M 10 114 Lara SKIN F 3 109 K George MEDICINE F 9 105 Johnson ORTHOPEDIC M 10 117 Lucy ENT F 3 111 Bill MEDICINE F 12 130 Morphy ORTHOPEDIC M 15 TABLE: SALARY
ID BASIC ALLOWANCE CONSULTATION
101 12000 1000 300 104 23000 2300 500 107 32000 4000 500 114 12000 5200 100 109 42000 1700 200 105 18900 1690 300 130 21700 2600 300 117 20100 1200 400 (i) Display the NAME of all doctors who are in “MEDICINE” having more than 10 years experience from the table DOCTOR. (ii) Display the average salary of all doctors working in “ENT” department using the table DOCTOR and SALARY. Where salary calculated as Salary=BASIC+ALLOWANCE. (iii) Display the minimum ALLOWANCE of female doctors. Find the output of the following commands.
(iv) Select count(*) from doctor where sex=’F’;
(v) SELECT NAME, DEPT, BASIC from DOCTOR , SALARY WHERE DEPT = “ENT” AND DOCTOR.ID = SALARY.ID; Doctor and Salary
i) SELECT NAME FROM DOCTOR WHERE EXPERIENCE >10 ANHD DEPT=’MEDICINE’;
ii) SELECT AVG(BASIC+ALLOWANCE) “SALARY” FROM DOCTOR, SALARY WHERE DEPT
=”ENT” AND DOCTOR.ID = SALARY.ID;
iii) SELECT MIN(ALLOWANCE) FROM DOCTOR, SALARY WHERE SEX=”F” AND
Instant download Maturing the Snowflake Data Cloud: A Templated Approach to Delivering and Governing Snowflake in Large Enterprises 1st ed. Edition Andrew Carruthers pdf all chapter