Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
26 views3 pages

Revision Ws 2

revision worksheet
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)
26 views3 pages

Revision Ws 2

revision worksheet
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/ 3

THE EMIRATES NATIONAL SCHOOL – SHARJAH

INFORMATICS PRACTICES Worksheet


Grade XII (2024-’25)
CHAPTER 4 – Database Query Using SQL
Equi-Join [Worksheet – 2]

1. Based on the tables PATIENT and DOCTOR, write SQL command and Output
for each of the following statements.

Table: PATIENT

NO PNAME AGE DEPTCODE DEPARTMENT DATEOFADMN CHARGES GENDER

1 ARPIT 62 501 SURGERY 21/01/2010 3000 M

2 ZAREENA 22 801 ENT 24/12/2009 2500 F

3 KAREEM 29 601 CARDIOLOGY 13/01/2010 7500 M

4 ANJU 45 501 SURGERY 11/01/2010 4800 F

5 ZUBIN 28 501 SURGERY 19/12/2009 3500 M

6 ANKITA 35 801 ENT 22/01/2010 4000 F

7 SHYAM 30 601 CARDIOLOGY 15/12/2009 9000 M

8 ZAMEENA 13 401 NUCLEAR MEDICINE 06/01/2010 5000 F

Table: DOCTOR
DEPTCODE DNAME

401 RAMKUMAR

501 ALOK NATH

601 MALINI VIJAY

801 ANAND VARMA


1. To display the average charges of surgery department.

2. To list the names of patients with their date of admission in the ascending order of date.

3. To count the number of patients above 30 years .

4. To list name, age and doctors name of all the male patients

5. To display all the departments in the hospital.

6. To display the total charges in each department.

7. To display department and number of patients in each department.

8. To display the details of all patients whose age is greater than 60 or charges greater than

8000.

9. To display department code, department and names of doctors in the hospital.

10. To count the number of patients treated by each doctor.

11. To display the name, department and gender of the patients treated by ‘Malini Vijay’

12. To display the highest and lowest charges of each doctor.

13. To increase the charges of cardiology department by 1,000.


14. To add a new column DATE_DISCHARGED to the table PATIENT.

2. Consider the following tables VEHICLE and CUSTOMER

Table: VEHICLE

VCode VName Make Color Capacity Price


501 A-Star Suzuki Red 3 4
503 Indigo Tata Silver 3 4
502 Innova Toyota White 7 15
509 SX4 Suzuki Silver 4 14
510 C Class Mercedes Red 4 35
Table: CUSTOMER

C_Code VCode CName City


C001 501 Hemant Shah Chandigarh
C002 509 Raj Lal Amritsar
C003 503 Feroz Shah Bangalore
C004 503 Ketan Dahl Delhi
C005 509 B M Rai Amritsar

(i) Name the Primary key of both the tables. Justify


(ii) Name the Foreign key of the table CUSTOMER
(iii) What will be the degree and cardinality of the Cartesian product of the above tables?
(iv) Write SQL command to find the number of vehicles in each make
(v) Write SQL command to display the customer name and vehicle name of all
customers.
(vi) What will be the data type of the column C_Code?
(vii) Check every value in VCode column of both the tables. Do you find any
discrepancy? State the discrepancy, if any.
(viii) Write the SQL command to display all the name and city of all customers having
vehicle color SILVER
(ix) Write SQL command to find the average seating capacity of each vehicle make
(x) Write SQL command to display the name and vehicle make of those customers
whose vehicle name starts with the letter ‘I’.
(xi) Write SQL command to display the vehicle code, name and city of all customers
who have purchased Indigo or A-Star.
(xii) Write SQL command to find the average price for each vehicle color.

You might also like