
charge should be greater than or equal to 200 :
Based on above table write the sql commands for the following :(Q2 to 16 - one marks each)
2. To show all information about the patients of cardiology department.
3. To list the names of female patients who are in orthopedic dept
4. To list names of all patients with their date of admission in ascending order
5. To display Patient’s Name, Charges, age for male patients only.
6. To insert a new row in the HOSPITAL table wit the following:
11,”mustafa”,37,”ENT”,(25/02/98},250,”M”
7. To increase the charges of female employees working in ENT department by 25 %.
8. To display the detail of doctors whose name’s second character is ‘a’ and second last character is ‘n’;
9. To add a new column contact number in the hospital table with varchar datatype of size 10.
10. To display the structure of the table .
11. To display unique charges value of hospital table.
12. Select length(concat(name , department)) from hospital where month(dateofadm)=1;
13. Select upper(name) , upper(department) from hospital where age between 45 and 60;
14. Write degree and cardinality of above table.
15. Select charges*length(name) , upper(name) from hospital where length(name)>6;
16. Write degree and cardinality of the query:
Select length(concat(name , department)) from hospital where month(dateofadm)=1;
17. What do you mean by foreign key . Explain with a suitable example.
18. Which SQL command should be used to change the datatype of columns of a table.
—-----------------------------------------------------------------------------------------------------------------------------
WORKSHEET - 2
make slno as primary key and assign NOT NULL Constraint to name , check constraint to charge where
1. Write SQL commands to create the following table ( consider datatype and size of the columns by your own
Write output for the following queries:
OXALISS INTERNATIONAL CBSE SCHOOL, THATCHUR
SUB: COMPUTER SCIENCE (083) CLASS : XII