0% found this document useful (0 votes)
22 views

Tables of Fly High

The document details the creation of database tables for an airline booking system including tables for users, flights, bookings, payments, cards and seat types. Primary keys and foreign keys are defined. Some tables like CustomerContact are noted as not being created.

Uploaded by

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

Tables of Fly High

The document details the creation of database tables for an airline booking system including tables for users, flights, bookings, payments, cards and seat types. Primary keys and foreign keys are defined. Some tables like CustomerContact are noted as not being created.

Uploaded by

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

tables of fly high

create database FlyHigh

create table UserTypes


(
userid int primary key,
usertype varchar(10) check(usertype In('Customer','Admin'))
)

drop table CustomerContact


drop table BookingInfo
drop table Users

create table Users


(
uid int identity(1,1),
emailid varchar(20) not null unique,
name varchar(50),
address varchar(100),
dob date,
password varchar(10) NOT NULL,
contactno varchar(12),
userid int references UserTypes(userid),
constraint pk_uid primary key(uid)
)

create table FlightInfo


(
flightid varchar(6),
source varchar(50) not null,
destination varchar(50) not null,
departtime time not null,
arrivaltime time not null,
departdate date not null,
arrivaldate date not null,
total_economy_seats int,
total_business_seats int,
economyprice bigint,
businessprice bigint,
constraint pk_flightid primary key(flightid)
)

create table SeatType


(
seatid int primary key,
seatname varchar(8) check(seatname In ('Economy','Business'))
)

create table BookingInfo


(
bookingid varchar(6) not null,
pnrno varchar(10) primary key,
flightid varchar(6) references FlightInfo(flightid),
bookingdate date not null ,
passenger_name varchar(50) not null ,
passenger_age int not null,
passenger_gender char not null,
price bigint not null,
seatno int not null,
customerid int references Users(uid),
seatid int references SeatType(seatid)
)

create table Payments


(
transactionid varchar(8) primary key,
transactiondate date not null,
amount bigint not null,
registrationid varchar(7) not null,
pnrno varchar(10) references BookingInfo(pnrno),
customerid int references Users(uid),
transaction_status varchar(12) not null
)

create table CardTypes


(
card_typeid int primary key,
cardtype varchar(10) check(cardtype In('Credit','Debit'))
)

create table CardDetails


(
cardno varchar(16) primary key,
card_holder_name varchar(50),
expirydate int,
expiryyear int,
merchantid varchar(10),
cardtypeid int references CardTypes(card_typeid),
cardownerid int references Users(uid)
)

---not creating---
create table CustomerContact
(
custid int,
contactno varchar(12),
constraint fk_custid foreign key(custid) references Users(uid),
constraint pk_custcontact primary key(custid,contactno)
)

You might also like