Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table Flights
- (
- flightnumber varchar(30) primary key,
- departure varchar(30),
- destination varchar(30),
- flightdate date ,
- planemodel varchar(30),
- price int,
- );
- create table Hotels
- (
- hotelsn varchar(30) primary key,
- hotelname varchar(30),
- country varchar(30),
- city varchar(30),
- street varchar(30) ,
- housenumber varchar(30),
- hotelrank float,
- price varchar(30),
- htraveldate date ,
- );
- create table Clients
- (
- id varchar(30) primary key,
- passportid varchar(30) ,
- firstname varchar(30) ,
- lastname varchar(30) ,
- gender varchar(10) ,
- country varchar(30) ,
- city varchar(30) ,
- street varchar(30) ,
- birthday date ,
- telephone varchar(30) ,
- email varchar (30) ,
- );
- create table orders
- (
- orderid varchar(30) primary key ,
- dealtype varchar(30) ,
- dealdate date ,
- nights varchar(10),
- totalprice varchar(10),
- people varchar(10),
- );
- create table flightsorder
- (
- orderid varchar(30) foreign key references orders (orderid) ,
- flightnumber varchar(30) foreign key references Flights (flightnumber) ,
- primary key(orderid , flightnumber) ,
- );
- create table hotelsorder
- (
- orderid varchar(30) foreign key references orders (orderid) ,
- hotelsnumber varchar(30) foreign key references Hotels (hotelsn) ,
- htraveldate date,
- primary key(orderid , hotelsnumber,htraveldate) ,
- );
- create table clientsorder
- (
- id varchar(30) foreign key references Clients (id) ,
- orderid varchar(30) foreign key references orders (orderid) ,
- primary key(id , orderid) ,
- );
- /*Flights for Thiland*/
- insert into Flights values('LY 082' , 'Ben-Gurion' , 'Bangkok - Survernabumi' , '2019/06/28' , 'Boeing 757' , '680'),
- ('LY 083' , 'Ben-Gurion' , 'Bangkok - Survernabumi' , '2019/06/29' , 'Boeing 767' , '670'),
- ('LY 084' , 'Ben-Gurion' , 'Bangkok - Survernabumi' , '2019/06/30' , 'Boeing 777' , '660'),
- ('LY 085' , 'Ben-Gurion' , 'Bangkok - Survernabumi' , '2019/07/01' , 'Boeing 757' , '650'),
- ('LY 086' , 'Ben-Gurion' , 'Bangkok - Survernabumi' , '2019/07/02' , 'Boeing 767' , '640'),
- /*Flights for Holland*/
- ('LY 337' , 'Ben-Gurion' , 'Amsterdam - Schipol' , '2019/06/28' , 'boeing 737' , '420'),
- ('LY 347' , 'Ben-Gurion' , 'Amsterdam - Schipol' , '2019/06/29' , 'boeing 747' , '390'),
- ('LY 237' , 'Ben-Gurion' , 'Amsterdam - Schipol' , '2019/07/04' , 'boeing 757' , '310'),
- ('LY 137' , 'Ben-Gurion' , 'Amsterdam - Schipol' , '2019/07/07' , 'boeing 767' , '430'),
- ('LY 546' , 'Ben-Gurion' , 'Amsterdam - Schipol' , '2019/07/09' , 'boeing 747' , '480'),
- /*Flights for Los Angeles*/
- ('LY 006' , 'Ben-Gurion' , 'Los Angeles - LAX' , '2019/07/29' , 'Dreamliner' , '990'),
- ('LY 016' , 'Ben-Gurion' , 'Los Angeles - LAX' , '2019/07/30' , 'Dreamliner' , '950'),
- ('LY 012' , 'Ben-Gurion' , 'Los Angeles - LAX' , '2019/07/31' , 'Dreamliner' , '1029'),
- ('LY 005' , 'Ben-Gurion' , 'Los Angeles - LAX' , '2019/08/03' , 'Dreamliner' , '1019'),
- ('LY 003' , 'Ben-Gurion' , 'Los Angeles - LAX' , '2019/08/08' , 'Dreamliner' , '900'),
- /*Flights for France*/
- ('TO 4970' , 'Ben-Gurion' , 'Lyon-Saint Exupéry' , '2019/04/17' , 'boeing 737 - Max' , '420'),
- ('TO 4870' , 'Ben-Gurion' , 'Lyon-Saint Exupéry' , '2019/04/20' , 'boeing 737 - Max' , '320'),
- ('TO 4650' , 'Ben-Gurion' , 'Lyon-Saint Exupéry' , '2019/04/23' , 'boeing 737 - Max' , '370'),
- ('TO 4660' , 'Ben-Gurion' , 'Lyon-Saint Exupéry' , '2019/04/26' , 'boeing 737 - Max' , '420'),
- ('TO 4520' , 'Ben-Gurion' , 'Lyon-Saint Exupéry' , '2019/04/29' , 'boeing 737 - Max' , '313'),
- /*Flights for Poland*/
- ('LY 564' , 'Ben-Gurion' , 'Warsaw - Chopin' , '2019/05/01' , 'AirBus 320' , '380'),
- ('LY 565' , 'Ben-Gurion' , 'Warsaw - Chopin' , '2019/05/03' , 'AirBus 320' , '319'),
- ('LY 566' , 'Ben-Gurion' , 'Warsaw - Chopin' , '2019/05/05' , 'AirBus 320' , '287'),
- ('LY 567' , 'Ben-Gurion' , 'Warsaw - Chopin' , '2019/05/07' , 'AirBus 320' , '299'),
- ('LY 568' , 'Ben-Gurion' , 'Warsaw - Chopin' , '2019/05/09' , 'AirBus 320' , '310')
- /*Hotels in Thailand*/
- insert into Hotels values ('052' ,'Bayshore hotel', 'Thailand' , 'Kohphangan','Ban Tai' ,'141' , '5' , '850' , '2019/06/28'),
- ('053' ,'Four Seasons', 'Thailand' , 'Koh Samui','Angthong' ,'219' , '4.8' , '3456' , '2019/06/29'),
- ('054' ,'Banyan Tree', 'Thailand' , 'Bangkok','Khet Sathon' ,'143' , '4.6' , '1252', '2019/06/30'),
- ('055' ,'Sino Imperial ', 'Thailand' , 'Phuket','Phuket road' ,'51' , '3.9' , '157' , '2019/07/01'),
- ('056' ,'Hilton', 'Thailand' , 'Pattaya','Bang Lamung' ,'333' , '4.5' , '662', '2019/07/02'),
- /*Hotels in Holland*/
- ('671' ,'Radisson Blu Hotel ', 'Holland' , 'Amsterdam','Rusland' ,'17' , '4.4' , '221', '2019/06/28'),
- ('672' ,'Olympic Hotel ', 'Holland' , 'Amsterdam','IJsbaanpad' ,'1076' , '4' , '419', '2019/06/29'),
- ('673' ,'Linden Hotel ', 'Holland' , 'Amsterdam','Lindengracht' ,'1015' , '3' , '200', '2019/07/04'),
- ('674' ,'Sir Adam Hotel ', 'Holland' , 'Amsterdam','Overhoeksplein' ,'7' , '4.4' , '280', '2019/07/07'),
- ('675' ,'City Hotel Amsterdam ', 'Holland' , 'Amsterdam','Prins Hendrikkade ' ,'130' , '3' , '170' , '2019/07/09'),
- /*Hotels in Los Angeles*/
- ('123' ,'The Beverly Hills Hotel', 'USA California ' , 'Los Angeles','Sunset Boulevard' ,'9641' , '5' , '645', '2019/07/29'),
- ('124' ,'The LINE Hotel', 'USA California ' , 'Los Angeles','Wilshire Boulevard' ,'3515' , '4' , '425', '2019/07/30'),
- ('125' ,'Hotel Angeleno', 'USA California ' , 'Los Angeles','North Church Lane' ,'170' , '4.2' , '478', '2019/07/31'),
- ('126' ,'Luxe City Center Hotel', 'USA California ' , 'Los Angeles','South Figueroa Street' ,'1020' , '4.6' , '512', '2019/08/03'),
- ('127' ,'The Jeremy Hotel ', 'USA California ' , 'Los Angeles','Sunset Boulevard' ,'8490' , '5' , '745', '2019/08/08'),
- /*Hotels in France*/
- ('134' ,'Sofitel Lyon Bellecour', 'France' , 'lyon','20 Quai Gailleton' ,'2' , '5' , '145', '2019/04/17'),
- ('135' ,'B&B Hôtel LYON Centre', 'France' , 'lyon','Rue Raulin' ,'7' , '3' , '99', '2019/04/20'),
- ('136' ,'Casa Marie', 'France' , 'lyon','rue des trois maries' ,'5' , '4' , '120' , '2019/04/23'),
- ('137' ,'Okko Hotels Lyon', 'France' , 'lyon','bis quai Général Sarrail' ,'6' , '4' , '130', '2019/04/26'),
- ('138' ,'Campanile Lyon', 'France' , 'lyon','Forum Part-Dieu' ,'31' , '3' , '110', '2019/04/29'),
- /*Hotels in Poland*/
- ('145' ,'Vienna House Mokotow', 'Poland' , 'Warsaw','Postepu' ,'4' , '4' , '60', '2019/05/01'),
- ('146' ,'Hampton by Hilton', 'Poland' , 'Warsaw','Wspólna' ,'72' , '4' , '120', '2019/05/03'),
- ('147' ,'InterContinental Warsaw', 'Poland' , 'Warsaw','Emilii Plater' ,'49' , '5' , '220', '2019/05/05'),
- ('148' ,'Hotel Metropol', 'Poland' , 'Warsaw','Marszałkowska' ,'99' , '3' , '50', '2019/05/07'),
- ('149' ,'Warsaw Marriott Hotel', 'Poland' , 'Warsaw','Al. Jerozolimskie' ,'65' , '5' , '280', '2019/05/09')
- /*Clients From Israel*/
- insert into Clients values ('205725567' , '305725567' ,'Osher' , 'Revach' ,'Male', 'Israel' , 'Nahariyya' , 'Hahalutz' , '1994/09/27' , '0509823235' , 'osher671@outlook.com'),
- ('311555114' , '405725567' ,'Yanir' , 'Itzhak' ,'Male', 'Israel' , 'Shlomi' , 'Yefe Nof' , '1993/09/21' , '0544498454' ,'yanir401@gmail.com'),
- ('123456789' , '789456123' ,'Haim' , 'Schwetz' ,'Male', 'Israel' , 'Tel Aviv' , 'Ben Yehuda' , '1974/01/21' , '0545556789' , 'HaimS@outlook.com'),
- ('456789123' , '215725547' ,'Daniel' , 'Barak' ,'Male', 'Israel' , 'Karmiel' , 'Nesher' , '1994/02/20' , '05098231235' , 'Daniel18@walla.com'),
- ('205725127' , '305725567' ,'Dor' , 'Peled' ,'Male', 'Israel' , 'Nahariyya' , 'Hanita' , '1994/09/10' , '0509823435' , 'Dorpe18@gmail.com'),
- /*Clients From USA*/
- ('264163639' , '204504874' ,'Athena' , ' Patterson' ,'Female', 'USA - Florida' , 'Jacksonville' , 'Boundary Street' , '2000/12/10' , ' 9046134259' , 'berneice1990@gmail.com'),
- ('523898454' , '829526909' ,'Dulce' , ' Artis' ,'Female', 'USA - Colorado' , 'Denver' , ' Shobe Lane' , '1980/03/19' , ' 3038172925' , 'marvin1987@gmail.com'),
- ('310012640' , '377653454' ,'Lucretia' , 'Jones' ,'Female', 'USA - Indiana' , 'Lafayyete' , 'Sugarfoot Lane' , '1973/03/01' , ' 3038172925' , 'alexandro1997@yahoo.com'),
- ('503271194' , '325233006' ,'Timothy' , 'Hayles' ,'Male', 'USA - South Dakota' , 'Pukwana' , 'Elsie Drive' , '1980/11/02' , '6052129590' , 'keaton_reil@gmail.com'),
- ('678015453' , '361886064' ,'Chris' , 'Lyon' ,'Male', 'USA - Arkansas' , 'Conway' , 'Masonic Hill Road' , '1978/12/16' , '5014654989' , 'tremayne_simon@hotmail.com'),
- /*Clients From Europe*/
- ('523898464' , '124526909' ,'Helmut' , ' Weber' ,'Male', 'Germany' , 'Taunusstein' , 'Witte Strase' , '1953/11/28' , '0752286818' , 'henning.susanne@freenet.de'),
- ('523128472' , '229556949' ,'Reinhard' , 'Zechner' ,'Male', 'Austria' , 'Grein' , 'Georg Lechner' , '1998/11/05' , '06993440551' , 'albrecht.noah@gmail.com'),
- ('223893254' , '129426609' ,'Hollie' , ' Grant' ,'Female', 'United Kingdom' , 'Grangetown' , 'Spilman Street' , '1939/06/27' , '07958172239' , 'HollieGrant@teleworm.us'),
- ('456123454' , '123545609' ,'Lucas' , ' Fitzgerald' ,'Male', 'France' , 'Paris' , 'Faubourg Saint Honoré' , '1973/10/14' , ' 0135243323' , 'LucasFitzg@gmail.com'),
- ('224291354' , '642326909' ,'Amber' , ' John' ,'Female', 'Holland' , 'Draaibrug' , 'Aardenburg' , '1956/02/12' , '0634973843' , 'AmberJohn@armyspy.com'),
- /*Clients From Asia*/
- ('325725512' , '205642567' ,'Xiuying' , ' Hou' ,'Male', 'Singapore' , 'Singapore' , 'Brooke Street' , '1967/09/30' , '6563421948' , 'HouHou671@outlook.com'),
- ('425725513' , '305642568' ,'Lingxin' , 'Kong' ,'Male', 'Hong Kong' , 'Western District' , 'Gaathon' , '1967/09/30' , '8522424382' , 'KongKing12@outlook.com'),
- ('525725514' , '405642569' ,'Kamaaluddeen' , 'el Mansoor' ,'Male', 'Qatar' , 'Doha' , 'Airport Road' , '1995/03/05' , '0097444416455' , 'SamiHaqatar@outlook.com'),
- ('022487849' , '132487849' ,'Burimas' , 'Ratana' ,'Male', 'Thailand' , 'Bangkok' , 'Rama 9 Road' , '1980/05/11' , '022480059' , 'DagBuri@PadThai.com'),
- ('436396916' , '129396916' ,'Embun bin' , 'Kemuning' ,'Male', 'Malasya' , 'Selangor' , 'Bandar Baru Sungai' , '1984/12/05' , '036156916' , 'FlyMalasia@Crush.com'),
- /*Clients From SouthAmerica*/
- ('125725413' , '005642537' ,'Fabio Mohamed' , ' Janssens Vilorio' ,'Male', 'Ecuador' , 'Pichincha' , 'Real del Monti' , '1990/08/06' , '9738887483' , 'auvilorio20@yopmail.com'),
- ('175725513' , '225642468' ,'Magdalena' , 'Cornellas' ,'Female', 'Argentina' , 'San Luis' , 'Privada Madre de Dios' , '1977/09/30' , '9491999538' , 'gemagdalenag4@yopmail.com'),
- ('441922482' , '189200381' ,'Nancy Resines' , 'Nabilr' ,'Female', 'Brazil' , 'Pernambuco' , 'Boulevard Farid' , '1976/10/23' , '558884002' , 'hvnabil21@yopmail.com'),
- ('431672451' , '023225853' ,'Pericles Mauro' , 'Lopez Louah' ,'Male', 'Colombia' , 'Sucre' , 'Calle Buenaposada' , '1987/05/21' , '8482554522' , 'periclesmauro@yopmail.com'),
- ('570509442' , '644819365' ,'Beltane Vial' , 'González' ,'Male', 'Peru' , 'Madre de Dios' , 'Escarp' , '1992/03/28' , '3534444919' , 'zarate12@yopmail.com')
- /*Deals For Thailand*/
- insert into orders values ('123456789' , 'AllInclude' , '2019/06/28' ,'15', '1645' , '4'),
- ('123456780' , 'AllInclude' , '2019/06/29' ,'18', '1945' , '5'),
- ('123456781' , 'AllInclude' , '2019/06/30' ,'16', '1478' , '3'),
- ('123456782' , 'AllInclude' , '2019/07/01' ,'12', '1245' , '2'),
- ('123456783' , 'AllInclude' , '2019/07/02' ,'11', '1145' , '1'),
- /*Deals Order for Holland*/
- ('135792468' , 'Breakfast inc' , '2019/06/28' ,'5', '629' , '2'),
- ('135792469' , 'Breakfast inc' , '2019/06/29' ,'6', '650' , '6'),
- ('135792461' , 'Breakfast inc' , '2019/07/04' ,'4', '440' , '3'),
- ('135792462' , 'Breakfast inc' , '2019/07/07' ,'3', '329' , '2'),
- ('135792463' , 'Breakfast inc' , '2019/07/09' ,'7', '750' , '4'),
- /*Deals Order for Los Angeles*/
- ('111111111' , 'AllInclude' , '2019/07/29' ,'15', '1645' , '4'),
- ('111111112' , 'AllInclude' , '2019/07/30' ,'18', '1849' , '5'),
- ('111111113' , 'AllInclude' , '2019/07/31' ,'16', '1172' , '3'),
- ('111111114' , 'AllInclude' , '2019/08/03' ,'12', '1298' , '2'),
- ('111111115' , 'AllInclude' , '2019/08/08' ,'11', '1345' , '1'),
- /*Deals Order for France*/
- ('222222222' , 'Breakfast inc' , '2019/04/17' ,'4', '390' , '1'),
- ('222222223' , 'Flight and Hotel only' , '2019/04/20' ,'5', '320' , '3'),
- ('222222224' , 'AllInclude' , '2019/04/23' ,'5', '690' , '4'),
- ('222222225' , 'Breakfast inc' , '2019/04/26' ,'2', '310' , '2'),
- ('222222226' , 'Breakfast inc' , '2019/04/29' ,'2', '230' , '1'),
- /*Deals Order for France*/
- ('333333333' , 'Breakfast inc' , '2019/05/01' ,'4', '390' , '1'),
- ('333333334' , 'Flight and Hotel only' , '2019/05/03' ,'5', '320' , '3'),
- ('333333335' , 'AllInclude' , '2019/05/05' ,'5', '690' , '4'),
- ('333333336' , 'Breakfast inc' , '2019/05/07' ,'2', '310' , '2'),
- ('333333337' , 'Breakfast inc' , '2019/05/09' ,'2', '230' , '1')
- /*Flights Order for Thiland*/
- insert into flightsorder values ('123456789' ,'LY 082'),
- ('123456780' ,'LY 083'),
- ('123456781' ,'LY 084'),
- ('123456782' ,'LY 085'),
- ('123456783' ,'LY 086'),
- /*Flights Order for Holland*/
- ('135792468' ,'LY 337'),
- ('135792469' ,'LY 347'),
- ('135792461' ,'LY 237'),
- ('135792462' ,'LY 137'),
- ('135792463' ,'LY 546'),
- /*Flights Order for Los Angeles*/
- ('111111111' ,'LY 006'),
- ('111111112' ,'LY 016'),
- ('111111113' ,'LY 012'),
- ('111111114' ,'LY 005'),
- ('111111115' ,'LY 003'),
- /*Flights Order for France*/
- ('222222222' ,'TO 4970'),
- ('222222223' ,'TO 4870'),
- ('222222224' ,'TO 4650'),
- ('222222225' ,'TO 4660'),
- ('222222226' ,'TO 4520'),
- /*Flights Order for Poland*/
- ('333333333' ,'LY 564'),
- ('333333334' ,'LY 565'),
- ('333333335' ,'LY 566'),
- ('333333336' ,'LY 567'),
- ('333333337' ,'LY 568')
- /*Thailand Hotels*/
- insert into hotelsorder values ('123456789' ,'052' ,'2019/06/28'),
- ('123456780' ,'053' ,'2019/06/29'),
- ('123456781' ,'054' ,'2019/06/30'),
- ('123456782' ,'055' ,'2019/07/01'),
- ('123456783' ,'056' ,'2019/07/02'),
- /*Holland Hotels*/
- ('135792468' ,'671' ,'2019/06/28'),
- ('135792469' ,'672' ,'2019/06/29'),
- ('135792461' ,'673', '2019/07/04'),
- ('135792462' ,'674', '2019/07/07'),
- ('135792463' ,'675', '2019/07/09'),
- /*Los Angeles Hotels*/
- ('111111111' ,'123', '2019/07/29'),
- ('111111112' ,'124', '2019/07/30'),
- ('111111113' ,'125', '2019/07/31'),
- ('111111114' ,'126', '2019/08/03'),
- ('111111115' ,'127', '2019/08/08'),
- /*France Hotels*/
- ('222222222' ,'134', '2019/04/17'),
- ('222222223' ,'135', '2019/04/20'),
- ('222222224' ,'136', '2019/04/23'),
- ('222222225' ,'137', '2019/04/26'),
- ('222222226' ,'138', '2019/04/29'),
- /*Poland Hotels*/
- ('333333333' ,'145', '2019/05/01'),
- ('333333334' ,'146', '2019/05/03'),
- ('333333335' ,'147', '2019/05/05'),
- ('333333336' ,'148', '2019/05/07'),
- ('333333337' ,'149', '2019/05/09')
- /*Orders From Israel Client*/
- insert into clientsorder values('205725567' ,'123456789'),
- ('311555114' ,'135792468'),
- ('123456789' ,'111111111'),
- ('456789123' ,'222222222'),
- ('205725127' ,'333333333'),
- /*Order from USA Clients*/
- ('264163639' ,'123456780'),
- ('523898454' ,'135792469'),
- ('310012640' ,'111111112'),
- ('503271194' ,'222222223'),
- ('678015453' ,'333333334'),
- /*Order From Europe Clients*/
- ('523898464' ,'123456781'),
- ('523128472' ,'135792460'),
- ('223893254' ,'111111113'),
- ('456123454' ,'222222224'),
- ('224291354' ,'333333335'),
- /*Order From Asia Clients*/
- ('325725512' ,'123456782'),
- ('425725513' ,'135792461'),
- ('525725514' ,'111111114'),
- ('022487849' ,'222222225'),
- ('436396916' ,'333333336'),
- /*Order From SA Clients*/
- ('125725413','123456783'),
- ('175725513','135792462'),
- ('441922482','111111115'),
- ('431672451','222222226'),
- ('570509442','333333337')
- /*Sheailtot*/
- update Clients
- Set lastname = 'Pishoto'
- where id = 205725567;
- update Flights
- set destination = 'John Paul II - Krakow'
- where flightnumber ='LY 564'
- select *
- from Flights , Hotels , orders
- where flightnumber = 'LY 082' and hotelname = 'Bayshore hotel resort' and orderid = '123456789';
- select *
- from Flights
- where price BETWEEN 380 AND 680;
- update Hotels
- set housenumber = 9699
- where hotelsn = '123';
- select *
- From Clients
- where lastname = 'Itzhak'
- select *
- From Flights
- where flightdate BETWEEN '2019/05/01' AND '2019/06/28'
- select *
- from Clients
- where city = 'Nahariyya'
- select city,count(id)
- from Clients
- group by city
- select AVG(price)
- from Hotels
- where country = 'Thailand'
- select *
- from Hotels
- where country = 'Thailand'
- select * ,DATEDIFF(YY,birthday,GETDATE()) AS AGE
- from Clients
- where birthday = min(DATEDIFF(YY,birthday,GETDATE()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement