CBSE Computer Science - Revision Tour(Solved) CBSE Guess > eBooks > Class XII > CBSE Computer Science Structure Query Language Solved Revision Tour By Mr. Ravi Kiran COMPUTER SCIENCE STRUCTURED QUERY LANGUAGE DELHI 2006: 5.b) Study the following tables DOCTOR and SALARY and write SQL commands for the questions (i) to (iv) and give outputs for SQL queries (v) to (vi) : TABLE: DOCTOR
TABLE: SALARY
(i) Display NAME of all doctors who are in “MEDICINE” having more than 10 years experience from the Table DOCTOR. Ans: Select Name from Doctor where Dept=”Medicine” and Experience>10 (ii) Display the average salary of all doctors working in “ENT”department using the tables.
DOCTORS and SALARY Salary =BASIC+ALLOWANCE. Ans: Select avg(basic+allowance) from Doctor,Salary where Dept=”Ent” and Doctor.Id=Salary.Id (iii) Display the minimum ALLOWANCE of female doctors. Ans: Select min(Allowance) from Doctro,Salary where Sex=”F” and Doctor.Id=Salary.Id (iv) Display the highest consultation fee among all male doctors. Ans: Select max(Consulation) from Doctor,Salary where Sex=”M” and Doctor.Id=Salary.Id (v) SELECT count (*) from DOCTOR where SEX = “F” Ans: 4 (vi) SELECT NAME, DEPT , BASIC from DOCTOR, SALRY Where DEPT = “ENT” AND DOCTOR.ID = SALARY.ID Ans: Name Dept Basic
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( mrkdata@yahoo.com ) |