0% found this document useful (0 votes)
343 views23 pages

Dbms (Lab) Da-1: Table Creation For Airline Database

The document describes the creation of 9 tables for an airline database - Airport, Flight, Flight_Leg, Leg_Instance, Fare, Airplane_Type, Can_Land, Airplane, and Seat_Reservation. It also describes inserting sample data into the tables and querying the tables to return various flight, airport, and reservation details. The tables are then altered to add foreign keys, make the airport name unique, and make the weekdays attribute multi-valued.

Uploaded by

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

Dbms (Lab) Da-1: Table Creation For Airline Database

The document describes the creation of 9 tables for an airline database - Airport, Flight, Flight_Leg, Leg_Instance, Fare, Airplane_Type, Can_Land, Airplane, and Seat_Reservation. It also describes inserting sample data into the tables and querying the tables to return various flight, airport, and reservation details. The tables are then altered to add foreign keys, make the airport name unique, and make the weekdays attribute multi-valued.

Uploaded by

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

DBMS(LAB) DA-1

REGNO:20MIS0445
NAME: DASARI SIVARAM

TABLE CREATION FOR AIRLINE DATABASE:

TABLE-1:

CREATE TABLE AIRPORT(AIRPORT_CODE VARCHAR(15),NAME VARCHAR(15),CITY


VARCHAR(15),STATE VARCHAR(15),PRIMARY KEY(AIRPORT_CODE));

OUTPUT:
Table created.

TABLE-2:

CREATE TABLE FLIGHT(FLIGHT_NUMBER INT,AIRLINE VARCHAR(15),WEEKDAYS


VARCHAR(15),PRIMARY KEY(FLIGHT_NUMBER));

OUTPUT:
Table created.

TABLE-3:

CREATE TABLE FLIGHT_LEG(FLIGHT_NUMBER INT,LEG_NUMBER


INT,SCHEDULED_DEPARTURE_TIME VARCHAR(27),DEPARTURE_AIRPORT_CODE
VARCHAR(15),ARRIVAL_AIRPORT_CODE VARCHAR(15),SCHEDULED_ARRIVAL_TIME
VARCHAR(22),PRIMARY KEY(FLIGHT_NUMBER,LEG_NUMBER));

OUTPUT:
Table created.

TABLE-4:

CREATE TABLE LEG_INSTANCE(FLIGHT_NUMBER NUMBER(15),LEG_NUMBER


NUMBER(15),DATE1 DATE,NUMBER_OF_AVAILABLE_SEATS INT,AIRPLANE_ID
VARCHAR2(15),DEPARTURE_AIRPORT_CODE VARCHAR(15),DEPARTURE_TIME
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
TIMESTAMP(6),ARRIVAL_AIRPORT_CODE VARCHAR(15),ARRIVAL_TIME
TIMESTAMP(6),PRIMARY KEY(FLIGHT_NUMBER,LEG_NUMBER,DATE1));

OUTPUT:
Table created.

TABLE-5:

CREATE TABLE FARE(FLIGHT_NUMBER INT,FARE_CODE INT,AMOUNT


INT,RESTRICTIONS VARCHAR(15),PRIMARY KEY(FLIGHT_NUMBER,FARE_CODE));

OUTPUT:
Table created.

TABLE-6:

CREATE TABLE AIRPLANE_TYPE(AIRPLANE_TYPE_NAME VARCHAR2(15),MAX_SEATS


INT,COMPANY VARCHAR(15),PRIMARY KEY(AIRPLANE_TYPE_NAME));

OUTPUT:
Table created.

TABLE-7:

CREATE TABLE CAN_LAND(AIRPLANE_TYPE_NAME VARCHAR(15),AIRPORT_CODE


VARCHAR(15),PRIMARY KEY(AIRPLANE_TYPE_NAME,AIRPORT_CODE));

OUTPUT:
Table created.

TABLE-8:

CREATE TABLE AIRPLANE(AIRPLANE_ID INT,TOTAL_NUMBER_OF_SEATS INT,AIRPLANE_TYPE


VARCHAR(15),PRIMARY KEY(AIRPLANE_ID));

OUTPUT:

Table created.
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
TABLE-9:

CREATE TABLE SEAT_RESERVATION(FLIGHT_NUMBER INT,LEG_NUMBER INT,DATE2


DATE,SEAT_NUMBER INT,CUSTOMER_NAME VARCHAR(15),CUSTOMER_PHONE
INT,PRIMARY KEY(FLIGHT_NUMBER,LEG_NUMBER, DATE2,SEAT_NUMBER));

OUTPUT:
Table created.

DISPLAYING THE TABLES:

TABLE-1:

DESC AIRPORT

TABLE-2:

DESC FLIGHT
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
TABLE-3:

DESC FLIGHT_LEG

TABLE-4:

DESC LEG_INSTANCE
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
TABLE-5:

DESC FARE

TABLE-6:

DESC AIRPLANE_TYPE

TABLE-7:

DESC CAN_LAND
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
TABLE-8:

DESC AIRPLANE

TABLE-9:

DESC SEAT_RESERVATION

INSERTION OF ROWS IN EACH TABLE:

insert into airport values('&Airport_code','&Name','&City','&State'); 



insert into Flight
values('&Flight_number','&Airline','&Weekdays');


 insert into

Flight_Legvalues('&Flight_number','&Leg_number','&Scheduled
_departure_time','&Departu
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
re_airport_code','&Arrival_airport_code','&Scheduled_arrival_ti
me');

insert into Fare
values('&Flight_number','&Fare_code','&Amount','&Restrictions')
 ;

insert into Airplane_Type
 values('&Airplane_type_name','&Max_seats','&Company'); 

insert into can_land
 values('&airplane_type_name','&airport_code');

insert into airplane
 values('&airplane_id','&total_number_of_seats','&airplane_type'); 

 insert into leg_instance

values('&flight_number','&leg_number','&dte','&number_of_ava
ilable_seats','&airplane_id','
&departure_airport_code','&departure_time','&arrival_airport_co
de','&arrival_time');

 insert into seat_reservation

values('&flight_number','&leg_number','&dte','&seat_number','&
customer_name','&customer _phone)
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
Query the Db to display:
1. The flight details:

2. Id and type of Airplane:

3. Airports that start with “K”:


DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM

4. Airports (name) in Tamilnadu

5. Seat reservation details for a given customer name and date:

6. Flight numbers that are scheduled on Wednesday or contain India


in the name:
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM

7. Airplane details for which type is not known:

8. Flight leg details that has a departure and arrival airport code:
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
9. Airport details that is not in 'Chennai':
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
10. Seat reservations that are made during last month:

11. Fare code for amount in range 21000 to 37000:

12. Airplane company names that contains exactly 3 'S' in it:


As there are no company with 3’s in my database it is displaying as
no rows selected.
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM

13. Flight leg details that has leg #s 1, 3, and 4:


DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
14. Maximum seats in airplane:

15. Number of leg instances of a flight number:

16. Total amount collected as fare for a given flight number:


DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
B. Alter the tables to
1)Add required foreign keys:
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM

. 2)Make name of airport as Unique and weekdays as not null:

3. Make weekdays as multivalued attribute:


DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM
DBMS(LAB) DA-1
REGNO:20MIS0445
NAME: DASARI SIVARAM

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy