drop table Certified;
drop table Employees;
drop table Aircraft;
drop table Flight;

create table Flight(flno: integer, 
	from: char(10), to: char(10), 
	distance: integer, departs: date, 
	arrives: date,
	primary key (flno));

create table Aircraft(aid: integer, 
	aname: char(20), 
	cruiserange: integer,
	primary key (aid));

create table Employees(eid: integer, 
	ename: char(30), 
	salary: integer, 
	primary key (eid));

create table Certified(eid: integer, 
	aid: integer, 
	primary key (eid, aid), 
	foreign key (eid) references Employees(eid),
	foreign key (aid) references Aircraft(aid));

insert into Flight(1, 'LAX', 'BOX', 1100, 
	to_date('11:20:30am', 'HH:MI:SSAM'), 
	to_date('7:20:30pm', 'HH:MI:SSPM'));

insert into Flight(2, 'LAX', 'SFO', 600, 
	to_date('6:00:00am', 'HH:MI:SSAM'), 
	to_date('8:00:00pm', 'HH:MI:SSAM'));

insert into Flight(3, 'SFO', 'WIS', 500, 
	to_date('6:00:00am', 'HH:MI:SSAM'), 
	to_date('11:00:00pm', 'HH:MI:SSAM'));

insert into Aircraft(1, 'Boeing', 1200);
insert into Aircraft(2, 'Boeing', 1200);
insert into Aircraft(3, 'Boeing', 1200);
insert into Aircraft(4, 'Airbus', 1500);
insert into Aircraft(5, 'Boeing', 2000);
insert into Aircraft(6, 'Airbus', 2500);

insert into Employees(1, 'Imagine Son', 100000);
insert into Employees(2, 'Real Son', 30000);
insert into Employees(3, 'Top Exec', 200000);
insert into Employees(4, 'Cleaner', 10000);
insert into Employees(5, 'Pilot Son', 101000);
insert into Employees(6, 'Pilot Who', 70000);

insert into Certified(5, 1);
insert into Certified(5, 4);
insert into Certified(5, 5);
insert into Certified(5, 6);

insert into Certified(6, 2);
insert into Certified(6, 3);
insert into Certified(6, 6);






