InterviewSolution
Saved Bookmarks
| 1. |
Consider the table FLIGHT given below Write commands in SQL for (i) to (iv) and output for (v) to (vii). TABLE: FLIGHTFLCODESTARTDESTINATIONNO_ STOPSNO_FLIGHTSIC101DelhiAgartala15IC102MumbaiSikkim13IC103DelhiJaipur07IC105KanpurChennai22IC107MumbaiKanpur04IC431IndoreChennai32IC721DelhiAhmedabad26(i) Display details of all flights starting from Delhi.(ii) Display details of flights that have more than 4 number of flights operating.(iii) Display flight codes, starting place, destination, number of flights in descending order of number of flights.(iv) Display destinations along with flight codes of all the destinations starting with 'A'.(v) SELECT MAX(NO_FLIGHTS) FROM FLIGHT(vi) SELECT DISTINCT(NO_STOPS) FROM FLIGHT(vii) SELECT START COUNT(.) FROM FLIGHT GROUP BY Start; |
|
Answer» (i) SELECT * FROM FLIGHT WHERE START = 'Delhi' (ii) SELECT * FROM FLIGHT WHERE NO _FLIGHTS > 4 (iii) SELECT FLCODE, START, DESTINATION, NO-FLIGHTS FROM FLIGHT ORDER BY NO-FLIGHTS DESC (iv) SELECT DESTINATION, FLCODE FROM FLIGHT WHERE DESTINATION LIKE "A%"; (v) MAX(No_FLIGHTS) 7 (vi) DISTINCT(NO_STOPS) 0 1 2 3 (vii) DELHI 3 MUMBAI 2 KANPUR 1 INDORE 1 |
|