Post on 21-Mar-2016
description
KUALA LUMPUR METROPOLITAN UNIVERSITY COLLEGE
INTRODUCTION TO DATABASE SQL ASSIGNMENT 2
AMALINA ABU BAKAR (01 200805 00190)
DALILAH ZABIDIN (01 200805 00167) ZULKHAIRY MOHD NOR (01 200805 00199)
D772 SIR RAJASAKERAN
[DIPLOMA IN MULTIMEDIA APPLICATION]
[28th
Oct 2010]
1. List all values from Route_header table. SELECT*FROM ROUTE_HEADER
2. List all values from Place_header header. SELECT*FROM PLACE_HEADER
3. Select the columns Route_id, Origin, Destination, Fare, Capacity from the table Route_header. SELECT ROUTE_ID, ORIGIN, FARE, CAPACITY FROM ROUTE_HEADER
4. List the unique Fare from the table Route_header. SELECT INSTINCT(FARE) FROM ROUTE_HEADER
5. List Fleet_id, Ticket_no, Origin, Destination, Total_fare order by Total_fare from Ticket_header. SELECT FLEET_ID, TICKET_ID, TICKET_NO, ORIGIN, DESTINATION, TOTAL_FARE FROM TICKET_HEADER
6. List all the details from Fleet_header where Cat_code=1. SELECT FLEET_ID, DAY, ROUTE_ID, CAT_CODE FROM FLEET_HEADER WHERE CAT_CODE='01'
7. Display the bus route numbers those the buses starting from Madras to Bangalore SELECT ROUTE_NO FROM ROUTE_HEADER WHERE ORIGIN='MADRAS' AND DESTINATION='BANGALORE'
8. Display the bus station from place_header table that those starts with the character C. SELECT*FROM PLACE_HEADER WHERE BUS_STATION LIKE 'C*'
9. Display the route numbers that those are the distance from 200 to 300 kilometers. SELECT ROUTE_NO FROM ROUTE_HEADER WHERE DISTANCE BETWEEN 200 AND 300
10. Display the name of the passengers are male from ticket_detail table. SELECT NAME FROM TICKET_DETAIL WHERE SEX='M'
11. Display the name of the passengers who travel with fare less than 18 from ticket_detail table. SELECT NAME FROM TICKET_DETAIL WHERE FARE<18
12. Display the name of the passengers who travel their age more than 20.
SELECT NAME FROM TICKET_DETAIL WHERE AGE>20