Air France

an anonymous user · April 08, 2021 · SQL
CREATE TABLE PILOTE (
  numéro_de_permis INTEGER PRIMARY KEY,
  nom TEXT NOT NULL,
  prénom TEXT NOT NULL,
  âge INTEGER, 
FOREIGN KEY (numéro_de_permis) REFERENCES VOL(permis),
FOREIGN KEY (numéro_de_permis) REFERENCES AVION (Numéro_série)
);
CREATE TABLE VOL (
  numéro_de_vol INTEGER PRIMARY KEY,
  destination TEXT NOT NULL,
  aéroport_de_départ TEXT NOT NULL,
  type_de_vol TEXT NOT NULL,
  permis TEXT NOT NULL,
  date DATE,
  FOREIGN KEY (aéroport_de_départ) REFERENCES DESTINATION(nom_aéroport)
);
CREATE TABLE DESTINATION (
  nom_aéroport TEXT NOT NULL PRIMARY KEY,
  pays TEXT NOT NULL,
  ville TEXT NOT NULL
);
CREATE TABLE PARTENAIRE (
  RCS INTEGER PRIMARY KEY,
  nom TEXT NOT NULL,
  statut_société TEXT NOT NULL
);
CREATE TABLE COMPAGNIE_AERIENNE (
  immatriculation TEXT NOT NULL PRIMARY KEY,
  nom TEXT NOT NULL
);
CREATE TABLE AVION (
  numéro_série INTEGER PRIMARY KEY,
  marque TEXT NOT NULL,
  modèle VARCHAR
);
CREATE TABLE s’associe (
 immatriculation INTEGER NOT NULL,
 RCS INTEGER NOT NULL,
 FOREIGN KEY (RCS) REFERENCES PARTENAIRE(RCS),
 FOREIGN KEY (immatriculation) REFERENCES COMPAGNIE_AERIENNE(immatriculation)
);
CREATE TABLE emploie (
 numéro_de_permis INTEGER NOT NULL,
 immatriculation  INTERGER NOT NULL,
 FOREIGN KEY (numéro_de_permis) REFERENCES PILOTE(numéro_de_permis),
 FOREIGN KEY (immatriculation) REFERENCES COMPAGNIE_AERIENNE(immatriculation)
);
CREATE TABLE possède (
 numéro_série INTEGER NOT NULL, 
 immatriculation INTEGER NOT NULL,
 FOREIGN KEY (numéro_série) REFERENCES AVION(numéro_série),
 FOREIGN KEY (immatriculation) REFERENCES COMPAGNIE_AERIENNE(immatriculation)
);
CREATE TABLE propose (
 numéro_de_vol INTEGER NOT NULL, 
 immatriculation INTEGER NOT NULL,
 FOREIGN KEY (numéro_de_vol) REFERENCES VOL(numéro_de_vol),
 FOREIGN KEY (immatriculation) REFERENCES COMPAGNIE_AERIENNE(immatriculation)
);
INSERT INTO PILOTE VALUES ('067304326769', 'IQBAL', 'Farah', '25'
); 
INSERT INTO PILOTE VALUES ('069345678901', 'BISOU', 'Frédéric', '55'
);
INSERT INTO PILOTE VALUES ('012373478901', 'BELVISI', 'Carla', '39'
);
INSERT INTO PILOTE VALUES ('678945321926', 'LEMANCHOT', 'Vincent', '42'
);
INSERT INTO PILOTE VALUES ('158165486947', 'CASTEX', 'Jean', '52'
);
INSERT INTO PILOTE VALUES ('758642814943', 'HAUPMAN','Eglantine', '29'
);
INSERT INTO PILOTE VALUES ('974315678901', 'PEREZ', 'Hélène', '32'
);
INSERT INTO VOL VALUES ('0259','Toulouse', 'Charles_De_Gaulle','court','067304326769', ' 01-01-2020'
);
INSERT INTO VOL VALUES ('0799', 'Tokyo', 'Charles_De_Gaulle', 'long','069345678901','09-02-2020'
);
INSERT INTO VOL VALUES ('0441', 'Pékin', 'Charles_De_Gaulle', 'long','012373478901', ' 02-05-2020'
);
INSERT INTO VOL VALUES('0843', 'Atlantide', 'Charles_De_Gaulle', 'long','678945321926', ' 20-06-2020'
);
INSERT INTO VOL VALUES ('0469','Chicago', 'Charles_De_Gaulle','long','158165486947', ' 14-08-2020'
);
INSERT INTO VOL VALUES ('0789','New_York', 'Charles_De_Gaulle','long','758642814943', '01-11-2020'
);
INSERT INTO VOL VALUES ('0467','Cancun', 'Charles_De_Gaulle','long','974315678901', ' 06-12-2020'
);
INSERT INTO VOL VALUES ('452', 'Wakanda', 'Charles_De_Gaulle' ,'moyen','977535678901', ' 19-12-2020'
);
INSERT INTO VOL VALUES ('666', 'Toronto', 'Charles_de_Gaulle', 'long','90005678901', ' 05-01-2021'
);
INSERT INTO VOL VALUES ('957', 'Antananarivo', 'Charles_de_Gaulle', 'moyen','912345678901', ' 12-02-2021'
);
INSERT INTO VOL VALUES ('6969', 'Agde', 'Charles_de_Gaulle', 'court','794315678901', ' 25-02-2021'
);
INSERT INTO DESTINATION VALUES ('Pearson_International_Airport', 'Canada', 'Toronto'
);
INSERT INTO DESTINATION VALUES ('International_Airport_Sangoku', 'Japon', 'Tokyo'
);
INSERT INTO DESTINATION VALUES ('Paradise', 'Madagascar', 'Antananarivo'
);
INSERT INTO DESTINATION VALUES ('Wonderland', 'Pays_des_Merveilles', 'Alicetown'
);
INSERT INTO DESTINATION VALUES ('International_Airport_khalifa', 'Liban', 'Beyrouth'
);
INSERT INTO DESTINATION VALUES ('International_Airport_Tom_Cruise', 'USA', 'Los_Angeles'
);
INSERT INTO DESTINATION VALUES ('International_Airport_Adèle_Burnier', 'USA', 'Los_Angeles'
);
INSERT INTO DESTINATION VALUES ('International_Airport_Poutine', 'Russie', 'Moscou'
);
INSERT INTO DESTINATION VALUES ('International_Airport_Evil', 'Turquie', 'Istanbul'
);
INSERT INTO DESTINATION VALUES ('International_Airport_Tony_Stark', 'USA', 'Los_Angeles'
);
INSERT INTO DESTINATION VALUES ('International_Airport_Kim_Jonk_I', 'Coré_du_Nord', 'Pyongyang'
);
INSERT INTO DESTINATION VALUES ('JFK', 'USA', 'New_York'
);
INSERT INTO PARTENAIRE VALUES ('75319', 'McDonald', 'SA'
);
INSERT INTO PARTENAIRE VALUES ('75415','IBIS','SA'
);
INSERT INTO PARTENAIRE VALUES ('85246', 'Stark_Company', 'SA'
);
INSERT INTO PARTENAIRE VALUES ('46314','Wayne_Enterprise','SA'
);
INSERT INTO PARTENAIRE VALUES ('85203','Samsung' ,'SAS'
);
INSERT INTO PARTENAIRE VALUES ('64318', 'Money_Bank', 'SAS'
);
INSERT INTO PARTENAIRE VALUES ('78632','Weyland-Yutani_Corporation','SA'
);
INSERT INTO PARTENAIRE VALUES ('94321', 'Umbrella_Corporation','SA'
);
INSERT INTO PARTENAIRE VALUES ('10000', 'Goodnight_Hotel', 'SAS'
);
INSERT INTO PARTENAIRE VALUES ('45621','Stak_industrie','SA'
);
INSERT INTO COMPAGNIE_AERIENNE VALUES ('552043002', 'Air_France' 
);
INSERT INTO AVION VALUES ('7755221144', 'Airbus', 'A320_200'
);
INSERT INTO AVION VALUES ('030102458','Airbus', 'A321'
);
INSERT INTO AVION VALUES ('6968676564', 'Boeing', '737_700'
);
INSERT INTO AVION VALUES ('0000000001', 'Boeing','737_800'
);
INSERT INTO AVION VALUES ('9874563210', 'Bombardier', 'CRJ_700'
);
INSERT INTO AVION VALUES ('0267536984', 'Bombardier', 'CRJ_1000'
);
INSERT INTO AVION VALUES ('101010101010', 'Embraer', '145'
);
INSERT INTO AVION VALUES ('0673043267', 'ATR', '72-600'
);
SELECT* FROM DESTINATION;
SELECT MAX (âge) FROM PILOTE;
SELECT AVG (âge) FROM PILOTE;
SELECT destination FROM Vol where VOL.type_de_vol = 'court';
SELECT nom, prénom FROM PILOTE where PILOTE.numéro_de_permis = '067304326769';
SELECT count(numéro_de_vol) FROM VOL, DESTINATION WHERE Vol.aéroport_de_départ = 'Charles_De_Gaulle' AND DESTINATION.ville = 'Los_Angeles';
SELECT count (type_de_vol) FROM VOL WHERE VOL.DATE > 20-06-2020 and VOL.type_de_vol = 'long';
SELECT count (statut_société) FROM PARTENAIRE WHERE PARTENAIRE.statut_société= 'Sarl';

Comments

Please sign up or log in to contribute to the discussion.