0% 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

Uploaded by

ankushrio83006
Copyright
© © All Rights Reserved
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% 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

Uploaded by

ankushrio83006
Copyright
© © All Rights Reserved
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


DOCTOR.ID = SALARY.ID;

iv) 4

v)
John ENT 12000
Lucy ENT 20100

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy