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

Class 8 Worksheet Database

Ezzz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views3 pages

Class 8 Worksheet Database

Ezzz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Class 8

SISHYA
Database worksheet
The database table below contains details about the airplanes that are flying in a country.
FLIGHTDETAILS
FLIGHTCODE DEPARTTIME ORIGIN DESTINATION MILES CAPACITY
114 7:10 CHN LON 2475 210
202 10:43 DEL MUM 740 210
219 9:31 BAN LON 3442 250
622 12:19 CHN SFO 3857 250
132 15:35 MUM KOL 366 178
271 13:17 BAN SFO 3635 250
302 20:22 BAN KOL 229 180
117 10:10 LON BAN 3442 210
204 10:43 LGA ORD 740 210

1) Study the table and write the SQL queries for the given following statements(The first few
SQL statements are given as fill ups)
i) Add a new flight – Flight code 256 , Departure timing: 11:00 , Origin : TVN ,
Destination: DEL, miles : 700, capacity : 250.
INTO INSERT FLIGHTDETAILS VALUES (256 ”11:00” “TVN”,_”DEL”,700 , 250)
ii) Search query for origin and destination for flight with the code 271.
SELECT ORIGIN, DESTINATION FROM _FLIGHTDETAILS__ WHERE FLIGHTCODE = 271
iii) Search query for all flights from origin BAN.
SELECT * FROM FLIGHTDETAILS WHERE ORIGIN= “BAN”
iv) Search query for miles travelled by the flight from LGA to ORD.
SELECT MILES FROM FLIGHTDETAILS WHERE ORIGIN = “LGA” AND DESTINATION =
“ORD”
v) Update the miles to 8701 for the flight with the code 271.
UPDATE FLIGHTDETAILS SET MILES = 8701 WHERE FLIGHTCODE = 2701
vi) Search query to find the departing time of flight with the code 302.
SELECT DEPARTIME FROM FLIGHTDETAIL EHERE FLIGHTCODE = 302.

vii) Delete all details of the plane with flight code 622.
DELETE FROM FLIGHTDETAILS WHERE FLIGHTCODE=622.

viii) Update the flight capacity to 250 of the flight with code 204.
ix) Update the departing time to 11:30 for the flight with the code 202.
x) Delete all flight details origination from LGA.

2) Fill the table with the required values when each of the below SQL query is executed.
i) SELECT * FROM FLIGHTDETAILS WHERE CAPACITY = 210.

FLIGHTCODE DEPARTTIME ORIGIN DESTINATION MILES CAPACITY


7:10 2475 210
10:43 740 210
10:10 3442 210
10:43 740 210

ii) SELECT * FROM FLIGHTDETAILS WHERE ORIGIN = “CHN”.

FLIGHTCODE DEPARTTIME ORIGIN DESTINATION MILES CAPACITY


CHN
CHN

iii) SELECT ORIGIN, DESTINATION FROM FLIGHTDETAILS WHERE FLIGHTCODE=302.

iv) SELECT FLIGHTCODE FROM FLIGHTDETAILS WHERE MILES BETWEEN 3000 and 4000

v) SELECT ORIGIN, DEPARTTIME FROM FLIGHTDETAILS WHERE FLIGHTCODE IN (114,


219, 622)

vi) SELECT FLIGHTCODE, ORIGIN FROM FLIGHTDETAILS WHERE DESTINATION = “LON”

You might also like