SQL Practice Question
SQL Practice Question
Write SQL
commands for the statement (i) to (iv) and give outputs for
SQL queries (v) to (viii)
TABLE: CONSIGNEE
5. Study the following tables DOCTOR and SALARY and write SQL
commands for the questions (i) to (iv) and give outputs for SQL query
(v):
TABLE : DOCTOR:
ID NAME DEPT SEX EXPERIENCE
101 Johan ENT M 1
2
104 Smith ORTHOPEDI M 5
C
107 George CARDIOLOG M 1
Y 0
114 Lar SKIN F 3
a
109 K George MEDICINE F 9
105 Johnson ORTHOPEDI M 1
C 0
117 Luc ENT F 3
y
111 Bill MEDICINE F 1
2
130 Murphy ORTHOPEDI M 1
C 5
TABLE: SALARY
ID BASI ALLOWANCE CONSULTAIO
C N
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
(i) Display 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 tables. DOCTORS and
SALARY
( Salary =BASIC+ALLOWANCE)
(iii) Display the minimum ALLOWANCE of female doctors.
(iv) Display the highest consultation fee among all male doctors.
(v) SELECT count (*) from DOCTOR where SEX= “F”;
Thank you!!!