Sie sind auf Seite 1von 5

CREATE DATABASE FlightBooking;

CREATE TABLE Customer (


cus_id int(8) NOT NULL,
cus_email varchar(100) NOT NULL,
cus_address varchar(255) NOT NULL,
cus_phone int(20) NOT NULL,
cus_age int(2) NOT NULL,
PRIMARY KEY (cus_id)
);
CREATE TABLE TicketFlightBooking(
tfb_id int(8) NOT NULL,
cus_id int(8) NOT NULL,
airline_id int(8) NOT NULL,
flight_datetime DATE NOT NULL,
booking_made datetime(8) NOT NULL,
booking_seat_count int(4) NOT NULL,
PRIMARY KEY (tfb_id),
FOREIGN KEY (cus_id) REFERENCES Customer(cus_id),
FOREIGN KEY (airline_id) REFERENCES Airline(airline_id)
);

CREATE TABLE Airline(


airline_id int(8) NOT NULL,
airline_name varchar(255) NOT NULL,
airline_seat_capacity int(90) NOT NULL,
flight_start time NOT NULL,
flight_end time NOT NULL,
PRIMARY KEY (airline_id)
);

CREATE TABLE AirlineRow(


row_id int(8) NOT NULL,
airline_id int(8) NOT NULL,
row_seat_count int(90) NOT NULL,
PRIMARY KEY (row_id),
FOREIGN KEY (airline_id) REFERENCES Airline(airline_id)
);

CREATE TABLE SeatsBooking(


seat_bookingid int(8) NOT NULL,
tfb_id int(8) NOT NULL,
row_id int(8) NOT NULL,
seat_number int(90) NOT NULL,
seat_booking_datetime datetime NOT NULL,
PRIMARY KEY (seat_bookingid),
FOREIGN KEY (tfb_id) REFERENCES TicketFlightBooking(tfb_id),
FOREIGN KEY (row_id) REFERENCES AirlineRow(row_id)
);

CREATE TABLE TransactionTicket(


transaction_id int(8) NOT NULL,
cus_id int(8) NOT NULL,
trans_method varchar(255) NOT NULL,
trans_charge int(40) NOT NULL,
trans_date datetime NOT NULL,
trans_receipt_no int(100) NOT NULL,
PRIMARY KEY (transaction_id),
FOREIGN KEY (cus_id) REFERENCES Customer(cus_id)
);
//INSERT CUSTOMER
INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)
VALUES (1,'dino@gmail.com','Jln Temerloh 53200 Wilayah Persekutuan
53200',20,6012599324);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (2,'rika@gmail.com','2 Jln Lada Hitam Taman Sri Tengah 86000 Kluang Kluang
Johor',34,601855524);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (3,'rino@gmail.com','Gerai Mdkp 5 Jln Changlun 06010
Changlun',30,601155528);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (4,'dinar@gmail.com','Jln Cenderawasih 1 Taman Nuri 05300 Alor
Setar',25,601055581);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (5,'danu@gmail.com','Jln Kuala Pilah Batu 5 1/2 70400 Negeri
Sembilan',46,601755563);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (6,'rizal.danar@gmail.com','Jln Ahmad Shah 28000 Temerloh',44,601655534);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (7,'glassyastar_kam@gmail.com','No. 19 Mini Stadium Jln Pasir Pekan 17000
Pasir Mas Kelantan',18,601455550);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (8,'siti.safira@gmail.com','Jln Ss15/4E Ss15 47500Petaling Jaya
47500',20,601655555);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (9,'panot.bin_sikat@gmail.com','32 2nd Floor Jalan AU 1A/4A Taman Keramat
Permai 54200 Wilayah Persekutuan ',50,601355583);

INSERT INTO CUSTOMER (cus_id, cus_email, cus_address, cus_age, cus_phone)


VALUES (10,'busrisidi@gmail.com','2 Kom Bebas Cukai Jln Ibrahim Sultan 80300 Johor
',40,601355562);

//Airline INPUT
INSERT INTO Airline (airline_id, airline_name, airline_seat_capacity, flight_start,
flight_end)
VALUES (44,'Malaysia Airline',90,'21:30:33','23:30:44');

INSERT INTO Airline (airline_id, airline_name, airline_seat_capacity, flight_start,


flight_end)
VALUES (45,'Air Asia',50,'17:15:63','18:50:44');

INSERT INTO Airline (airline_id, airline_name, airline_seat_capacity, flight_start,


flight_end)
VALUES (46,'Garuda',90,'08:45:10','09:45:23');

INSERT INTO Airline (airline_id, airline_name, airline_seat_capacity, flight_start,


flight_end)
VALUES (47,'Lion Air',40,'12:45:10','09:35:02');

//ticket input
INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,
booking_made, booking_seat_count)
VALUES (20, 1, 44, '2019-11-17', '2019-05-23 17:55:30', 1);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (21, 5, 45, '2020-02-23', '2019-05-20 11:55:30', 4);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (22, 2, 46, '2019-11-13', '2019-02-39 08:55:30', 2);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (23, 3, 44, '2020-02-01', '2019-04-33 18:35:34', 3);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (24, 4, 45, '2020-09-21', '2019-06-21 14:51:34', 1);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (25, 6, 47, '2019-12-11', '2019-03-15 12:51:34', 3);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (26, 7, 46, '2019-08-06', '2019-03-24 13:49:22', 4);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (27, 8, 45, '2020-04-01', '2019-04-05 12:00:32', 2);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (28, 9, 44, '2019-10-31', '2019-04-07 22:30:32', 2);

INSERT INTO TicketFlightBooking (tfb_id, cus_id, airline_id, flight_datetime,


booking_made, booking_seat_count)
VALUES (29, 10, 46, '2019-09-24', '2019-02-07 20:33:10', 2);

//Airline ROW Input

INSERT INTO AirlineRow (row_id, airline_id, row_seat_count)


VALUES (50, 44, 15);
INSERT INTO AirlineRow (row_id, airline_id, row_seat_count)
VALUES (51, 45, 10);
INSERT INTO AirlineRow (row_id, airline_id, row_seat_count)
VALUES (52, 46, 15);
INSERT INTO AirlineRow (row_id, airline_id, row_seat_count)
VALUES (53, 40, 10);

//SeatsBooking input
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (90, 20, 50,22,"2019-05-23 17:55:30");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (91, 21, 51,40,"2019-05-20 11:55:30");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (92, 22, 52,36," 2019-02-39 08:55:30");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (93, 23, 53,68," 2019-04-33 18:35:34");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (94, 24, 52,20,"2019-06-21 14:51:34");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (95, 25, 51,40,"2019-03-15 12:51:34");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (96, 26, 50,12," 2019-03-24 13:49:22");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (97, 27, 52,82," 2019-04-05 12:00:32");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (98, 28, 51,36,"2019-04-07 22:30:32");
INSERT INTO SeatsBooking(seat_bookingid, tfb_id,
row_id,seat_number,seat_booking_datetime)
VALUES (99, 29, 53,37,"2019-02-07 20:33:10");

//INPUT TRANSACTION TICKET


INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (121,1,"Credit Card",5,"2019-05-24 12:55:30",01);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (122,5,"M-Banking",10,"2019-05-21 08:55:30",02);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (123,2,"7e",0,"2019-03-01 09:52:30",03);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (124,3,"Credit Card",5,"2019-04-34 01:35:34",04);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (125,4,"M-Banking",10," 2019-06-22 07:51:34",05);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (126,6,"Credit Card",5,"2019-03-16 09:51:34",06);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (127,7,"7e",0,"2019-03-25 12:49:22",07);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (128,8,"7e",0,"2019-04-06 15:00:32",08);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (129,9,"7e",0,"2019-04-07 24:30:32",09);
INSERT INTO TransactionTicket (transaction_id, cus_id, trans_method, trans_charge,
trans_date, trans_receipt_no)
VALUES (130,10,"Credit Card",5,"2019-02-07 24:33:10",10);

Das könnte Ihnen auch gefallen