English

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
Advertisements

Question

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
  1. Write a query to change the fare to 6000 of the flight whose FNO is F104.
  2. Write a query to display the total number of MALE and FEMALE PASSENGERS.
  3. Write a query to display the NAME, corresponding FARE and F_DATE of all PASSENGERS who have a flight to START from DELHI.
  4. Write a query to delete the records of flights which end at Mumbai.
Code Writing
Advertisements

Solution

  1. UPDATE FLIGHT SET FARE= 6000 WHERE FNO= 'F104';
  2. SELECT GENDER, COUNT (*) FROM PASSENGER GROUP BY GENDER;
  3. SELECT A.NAME, B.FARE, B.F_DATE FROM PASSENGER A, FLIGHT B WHERE A.FNO=B.FNO AND B.START='DELHI';
  4. DELETE FROM FLIGHT WHERE END ='MUMBAI';
shaalaa.com
  Is there an error in this question or solution?
2021-2022 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×