Write SQL queries for (a) to (d) based on the tables PASSENGER and FLIGHT given below: Table: PASSENGER PNO 1001 1002 1003 1004 NAME Suresh Anita Harjas Nita GENDER Male Female Male Female
Advertisements
प्रश्न
Write SQL queries for (a) to (d) based on the tables PASSENGER and FLIGHT given below:
Table: PASSENGER
PNO |
NAME |
GENDER |
FNO |
1001 |
Suresh |
Male |
F101 |
1002 |
Anita |
Female |
F104 |
1003 |
Harjas |
Male |
F102 |
1004 |
Nita |
Female |
F103 |
Table: FLIGHT
FNO |
START |
END |
F_DATE |
FARE |
F101 |
MUMBAI |
CHENNAI |
2021-12-25 |
4500 |
F102 |
MUMBAI |
BENGALURU |
2021-11-20 |
4000 |
F103 |
DELHI |
CHENNAI |
2021-12-10 |
5500 |
F104 |
KOLKATA |
MUMBAI |
2021-12-20 |
4500 |
F105 |
DELHI |
BENGALURU |
2021-01-15 |
5000 |
- Write a query to change the fare to 6000 of the flight whose FNO is F104.
- Write a query to display the total number of
MALEandFEMALEPASSENGERS. - Write a query to display the
NAME, correspondingFAREandF_DATEof all PASSENGERS who have a flight toSTARTfrom DELHI. - Write a query to delete the records of flights which end at Mumbai.
कोड लेखन
Advertisements
उत्तर
UPDATE FLIGHT SET FARE= 6000 WHERE FNO= 'F104';SELECT GENDER, COUNT (*) FROM PASSENGER GROUP BY GENDER;SELECT A.NAME, B.FARE, B.F_DATE FROM PASSENGER A, FLIGHT B WHERE A.FNO=B.FNO AND B.START='DELHI';DELETE FROM FLIGHT WHERE END ='MUMBAI';
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
