The document contains SQL commands and queries related to three tables: EMPLOYEE, SchoolBus, and GRADUATE, along with a HOSPITAL table. It includes tasks such as displaying employee details, filtering records based on salary and designation, and adding new entries to the tables. Additionally, it addresses queries about students' ranks and subjects, as well as patient information in a hospital setting.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
9 views4 pages
SQL Practical File Assignment
The document contains SQL commands and queries related to three tables: EMPLOYEE, SchoolBus, and GRADUATE, along with a HOSPITAL table. It includes tasks such as displaying employee details, filtering records based on salary and designation, and adding new entries to the tables. Additionally, it addresses queries about students' ranks and subjects, as well as patient information in a hospital setting.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
25. Consider the following table EMPLOYEE.
‘Table: EMPLOYEE
EX CS Bs
101 = Abdul Ahmad “EXECUTIVE S63 2003-03-23 1980-01-13 24000 8000
102. Ravi Chander HEAD-IT 02 2010-02-12 1987-07-22 32000 12000
103 John Ken RECEPTIONIST S03 2003-06-24 1983-02-24 24000 8000
105 Nazar Ameen GM soz 2006-08-11 1984-03-03 32000 12000
108 PriyamSen CEO so1 2004-12-29 1982-01-19 56000 18000
(a) Write SQL commands for (i) to (vi) and output for (vil):
{i) To display the details of all employees.
(ii) Ta display NAME and DESIGN of those employees whose SALGRADE is either $02 or S03.
(iii) To display details of the employees whose DO! is between ‘09-02-2006’ and '08-08-2009"
{iv) To add a new row with the following content: °
(109, ‘Harish Roy’, ‘HEAD-IT’, ‘S02’, ‘9-09-2007’, ‘21-04-1983, 32000, 12000)
(v) To display the details of all employees whose Salary is greater than 30000.
(vi) To display list of all unique SGrade.
(vii) SELECT SGrade, Salary+HRA FROM Employee WHERE SGrade ='S02' AND Desig =
Scanned with CamScannerAe) Consider the given table and answer the questions.
Table: SchoolBus
1 Vasant Kunj 100 10 1 Shivam Travels 3500
2 Hauz Khas 80 80 10 Anand Travels 3000
3 Pitampura 60 55 30 Anand Travels 4500
4 Rohini 100 90 35 Anand Travels 5000
5 Yamuna Vihar = 50 60 20 Bhalla Travels 3800
6 Krishna Nagar 70 80 30 Yadav Travels 4000
7 Vasundhara 100 110 20 Yadav Travels 3500
8 Paschim Vihar 40 40 20 Speed Travels 3200
9 Saket 120 120 10 Speed Travels 3500
10 Janakpuri 100 100 20 Kisan Tours 3500
(a) To show all information of schoolbus where capacity is more than 70.
{b) To show area_covered for buses covering more than 20 km., but charges less than 4000.
(c) To show transporter-wise details along with their charges.
(d) ToshowRtno, Area_Covered and Average cost per student for all routes where average cost per studer
is—Charges/Noofstudents.
(e) Add a new record with the following data:
(11, “Motibagh”, 35, 32, 10, “Kisan Tours”, 3500)
Scanned with CamScanner@ SQL commands for (a) to (d) and write the output for
Table: GRADUATE
(e) and (f) on the basis of given table GRADUATE:
1 KARAN = 400 PHYSICS, 68 i
2 RAL 450 CHEMISTRY 68 1
3 DEEP 300 MATHS 62 a
4 iva 350 CHEMISTRY 63 1
5 GAURAV 500 PHYSICS 70 iJ
6 MANAV 400 CHEMISTRY 55 2
7 VARUN 250 MATHS 64 1
8 UZA 450 COMPUTER 68 1
9 PUA 500 PHYSICS 62 1
10 NISHA 300 * COMPUTER 57 2
(a) List the names of those students who have obtained rank 1.
(b) Display a list of all those names whose average is greater than 65.
than 60.
(d) List the names of all students.
(e) SELECT * FROM GRADUATE WHERE Subject = "Physics";
{f) SELECT RANK FROM GRADUATE;
Display the names of those students who have opted computer as a subject with average of more
Scanned with CamScanner(3) answer the questions based on the table given below:
Table: HOSPITAL >
EX A
1 Arpit 62 Surgery 1998-01-21
2 Zareena 22 ENT 1997-12-12 250
3 Kareem 32. Orthopaedic 1998-02-19 200
4 Arun 12. Surgery 1998-01-11 300
5 Zubin 30. ENT 1998-01-12 250
6 Ketaki = «16 ENT. 1998-02-24 250
7 Ankita 29-~— Cardiology 1998-02-20 800
8 Zareen 45 Gynaecology 1998-02-22 300
9 Kush 19 Cardiology 1998-01-13 800
10 Shilpa 23.~—«Nuclear Medicine 1998-02-21 400
(i) To list the names of all the patients ai
dmitted after 15/01/98.
(ii) To list the names of female patients who are in ENLdepartment.
(iii) To list names of all patients with their date of admission.
(iv) To display Patient’s Name, Charges, Age for
Scanned with CamScanner
only female patients.
[chargess sexs)
300 M
m2z77577Z2227