SGBD Oracle Hotel franchise database project
-
Upload
nistor-cosmin -
Category
Documents
-
view
218 -
download
0
Transcript of SGBD Oracle Hotel franchise database project
-
7/24/2019 SGBD Oracle Hotel franchise database project
1/23
Academy of Economic Studies
Faculty of Cybernetics, Statistics and Economic Informatics
Database ProjectHotel franchise database
Student:
Nistor Cosmin Dumitru
rou! "#$%, E series
-
7/24/2019 SGBD Oracle Hotel franchise database project
2/23
Project theme
&his database is created to 'i(e to the mana'ement
information about its customers , )hat hotel they often choose,
)hat ser(ices they use most often and )hich are the em!loyees)ho !ro(ide most ser(ices* +ith this information, the hotel
mana'ement can determine )hich are their best em!loyees and
oer them !rimes, most re-uested ser(ices to increase the
number of em!loyees )ho !erform them and the most loyal
customers to oer them discounts and e.tra facilities*
&he database is easy to use and the structure of the table
allo)s the user to easily obtain all this information*
Database description
-
7/24/2019 SGBD Oracle Hotel franchise database project
3/23
&he database is com!osed of / tables accordin' to the ne.t
conce!tual scheme:
Relationship between the tables
0ne client can stay at more hotels and one hotel can ha(e more
customers* &o brea1 the many2to2many relationshi! )e create the
intersection entity named C3IEN&*
0ne hotel can oer more ser(ices and one ser(ice can be oered by
more hotels* &o brea1 the many2to2many relationshi! )e create theintersection entity named SE45ICES6CHEC7*
0ne customer can re-uest more ser(ices and one ser(ice can be
re-uested by more customers* &o brea1 the many2to2many relationshi!
)e create the intersection entity named SE45IN6CHEC7* 0ne em!loyee )or1s at one hotel and one hotel can ha(e more
em!loyees*
-
7/24/2019 SGBD Oracle Hotel franchise database project
4/23
0ne em!loyee is s!eciali8ed in oerin' only one ser(ice, and one
ser(ice can be oered by more em!loyees*
Tables description
&he H0&E3S table contains information about hotels: name,address,
city,!hone number*
C4EA&E &A93E H0&E3Sid6hotel N; C0NS&4AIN&S id6hotel6!1 P4I C0NS&4AIN&S name6hotel6nn CHEC7 name6hotel isnot N;33>,city CHA4%#> C0NS&4AIN& city6nn CHEC7 city is not N;33>,adress6hotel CHA4$#> C0NS&4AIN&S adress6hotel6nn CHEC7 adress6hotelis not N;33>,!hone6number CHA4"$> C0NS&4AIN&S !hone6number6u- ;NI@;E>
&he C;S&0,
!hone6number"$> C0NS&4AIN&S !hone6u- ;NI@;E,
email CHA4=#> C0NS&4AIN& email6u- ;NI@;E>
&he E,
id6ser(ices number=> C0NS&4AIN&S id6ser(ices6f1 4EFE4ENCES
SE45ICESid6ser(ice>,
name CHA4=#> C0NS&4AIN&S namee6nn CHEC7 name is not null>,
-
7/24/2019 SGBD Oracle Hotel franchise database project
5/23
!hone6number number"$> C0NS&4AIN&S !hone6numberb6u- ;NI@;E,
date6em!loyment DA&E>
&he SE45ICES table contains informations about the a(aible ser(ices:name, descri!tion and !rice*
C4EA&E &A93E SE45ICESid6ser(ice number=> C0NS&4AIN&S id6ser(ice6!1 P4I C0NS&4AIN&S name6nn CHEC7 name6ser(ice is not
null>,
descri!tion6ser(ice 5A4CHA4%=#> C0NS&4AIN&S descri!tion6u- ;NI@;E,
!rice number,%> C0NS&4AIN&S !rice6nn CHEC7 !rice is not null>>
&he C3IEN&S table is the intersection table that contains informationsabout )hat customers chec1 in at )hat hotels*
C4EA&E &A93E C3IEN&Scustomer6id number=> C0NS&4AIN&S customerr6id6f1 4EFE4ENCES
C;S&0,
id6hotel number=> C0NS&4AIN&S id6hotelr6f1 4EFE4ENCES
H0&E3Sid6hotel>,
chec1in6number number$> C0NS&4AIN&S chec1in6number6nn CHEC7
chec1in6number is not null>,
date6last6chec1in DA&E>
&he SE45ICES6CHEC7 table is the intersection table that oersinformations about )hat hotel oers )hat ser(ices*
C4EA&E &A93E SE45ICES6CHEC7
id6ser(ice number=> C0NS&4AIN&S id6ser(ice6f1 4EFE4ENCES
SE45ICESid6ser(ice>,
id6hotel number=> C0NS&4AIN&S id6hotels6f1 4EFE4ENCES
H0&E3Sid6hotel>,
oer6start DA&E C0NS&4AIN&S oer6start6nn not null>
&he SE45IN6CHEC7 table is the intersection table that oers
informations about )hat client uses certain ser(ices*
C4EA&E &A93E SE45IN6CHEC7
id6ser(ice number=> C0NS&4AIN&S id6ser(icesb6f1 4EFE4ENCES
SE45ICESid6ser(ice>,
-
7/24/2019 SGBD Oracle Hotel franchise database project
6/23
customer6id number=> C0NS&4AIN&S customer6id6f1 4EFE4ENCES
C;S&0,
utilisation6no char"#> C0NS&4AIN&S utilisation6no6nn not null>
Data defnition language comands (CREATE, ALTER,DRP!
"> 22Add in the C;S&0
%> 22Create a ne) table H0&E36S&A4S )ith the attributes id6hotel and
stars6no*
C4EA&E &A93E H0&E36S&A4S
id6hotel number=> C0NS&4AIN&S id6hotelst6f1 4EFE4ENCESid6hotel>,
stars6no number%> C0NS&4AIN&S stars6no6nn CHEC7 stars6no is not null>>
=> 22Add in the H0&E3S table the stars6no attribute
A3&E4 &A93E H0&E3S
ADDstars6no number %>>
B> 22Delete the residence6city attribute
A3&E4 &A93E C;S&0 22Delete the H0&E36S&A4S table
D40P &A93E H0&E36S&A4S
> 22Add a null ty!e constraint for the stars6no attribute from the H0&E3S
table
A3&E4 &A93E H0&E3S
ADD C0NS&4AIN& stars6no6nn CHEC7 stars6no is not null>
-
7/24/2019 SGBD Oracle Hotel franchise database project
7/23
/> 22
-
7/24/2019 SGBD Oracle Hotel franchise database project
8/23
insert into H0&E3S (alues"B, Pheonicia Athene,9ucuresti,9ule(ardul
Dacia nr "2=,#%"B=B%=,$>
Populating the $ER"CE$ table using the "#$ERT
command'
insert into SE45ICES (alues",
insert into SE45ICES (aluesB, 5ault, Seif1ee! 'oods for stay !eriod, *$>
insert into SE45ICES (alues$, Child su!er(ision,&a1in' care of the
children,">
insert into SE45ICES (alues, Alarm,+a1in' u! customer on re-uest,#>
insert into SE45ICES (alues/, 4oom ser(ice,Food deli(ery in room,"*$>insert into SE45ICES (alues, Car !ar1in',Par1in' the customers car,B>
insert into SE45ICES (alues, Nonformal acti(ities,uest
entertainment,%#>
insert into SE45ICES (alues"#, Fitness,Acees to the hotels 'ym,/*>
insert into SE45ICES (alues"", Pool,Acces to the hotels !ool, >
Populating the C%$T)ER$ table using the "#$ERT
command'
insert into C;S&0
insert into C;S&0
insert into C;S&0
-
7/24/2019 SGBD Oracle Hotel franchise database project
9/23
insert into C;S&0
insert into C;S&0
insert into C;S&0
insert into C;S&0
insert into C;S&0
insert into C;S&0
insert into C;S&0
insert into C;S&0
insert into C;S&0insert into C;S&0
-
7/24/2019 SGBD Oracle Hotel franchise database project
10/23
Populating the E)PL*EE$ table using the "#$ERT
command'
insert into E
-
7/24/2019 SGBD Oracle Hotel franchise database project
11/23
-
7/24/2019 SGBD Oracle Hotel franchise database project
12/23
insert into E
(alues",",=, &06DA&E"$*#"*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues%,B,$, &06DA&E"=*#%*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues%,"B,, &06DA&E%$*#=*%#"=,DD*
-
7/24/2019 SGBD Oracle Hotel franchise database project
13/23
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues=,"",%%, &06DA&E%*#$*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues=,"%,==, &06DA&E=#*#=*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(aluesB,"=,B, &06DA&E"B*#*%#"%,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(aluesB,"%,=, &06DA&E%*#*%#"%,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues$,"",B, &06DA&E=#*""*%#"",DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues$,=,$, &06DA&E#$*"%*%#"#,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues,B,, &06DA&E"B*#*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>(alues,$,, &06DA&E"%*"#*%#"",DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues/,,, &06DA&E#*#*%#"",DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues/,/,/, &06DA&E#*#$*%#"%,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues,,, &06DA&E"$*#*%#"%,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues,,%#, &06DA&E%/*#/*%#"",DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues,"#,"#, &06DA&E=#*#*%#"#,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues"#,"","=, &06DA&E"B*#*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues"","%,"$, &06DA&E%=*#/*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues"%,"=,"/, &06DA&E%B*#*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues"=,"B,%/, &06DA&E"/*#*%#"",DD*insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues",",, &06DA&E%B*#*%#"#,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues"$,=,, &06DA&E=#*""*%#"",DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues",=,, &06DA&E%$*#*%#"",DD*
-
7/24/2019 SGBD Oracle Hotel franchise database project
14/23
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues"/,%,$, &06DA&E"B*"%*%#"%,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues",B,, &06DA&E=#*#"*%#"#,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues",,%, &06DA&E#%*#%*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues%#,,=, &06DA&E%B*#B*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues%",,"#, &06DA&E#%*#"*%#"%,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues%%,",, &06DA&E#=*#=*%#"#,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues%=,","", &06DA&E#=*#%*%#"",DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>(alues%=,","B, &06DA&E#=*#B*%#"",DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues%$,",/, &06DA&E#$*#B*%#"#,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues%$,",, &06DA&E#*#*%#"%,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues"",",B, &06DA&E"/*#/*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues",",$, &06DA&E"*#*%#"=,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues"/,",, &06DA&E%$*"#*%#"%,DD*
insert into C3IEN&Scustomer6id,id6hotel,chec1in6number,date6last6chec1in>
(alues",",/, &06DA&E%%*""*%#"",DD*
Populating the $ER"#+C&EC- table with the "#$ERT
command'
insert into SE45ICES6CHEC7id6ser(ice,id6hotel,oer6start> (alues
",",&06DA&E%%*""*%#"",DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
",,&06DA&E#"*#"*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
%,",&06DA&E#%*#"*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
%,B,&06DA&E#=*#%*%#"#,DD*
-
7/24/2019 SGBD Oracle Hotel franchise database project
15/23
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
=,$,&06DA&E#B*#=*%#"#,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
=,/,&06DA&E#%*#%*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
B,,&06DA&E#=*#=*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
B,,&06DA&E"B*#B*%#"",DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
$,"#,&06DA&E"$*#B*%#"",DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
$,"B,&06DA&E#*#$*%#"#,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
,",&06DA&E#/*#$*%#"",DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues,%,&06DA&E#*#/*%#"",DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
/,=,&06DA&E#/*#/*%#"#,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
/,B,&06DA&E#*#*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
,$,&06DA&E""*#*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
,,&06DA&E"%*#*%#"%,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
,/,&06DA&E"$*#*%#"=,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
,,&06DA&E#$*"#*%#"",DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
"#,,&06DA&E%=*"#*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
"#,"#,&06DA&E#%*""*%#"%,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
"","",&06DA&E#"*"%*%##,DD*insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
"","",&06DA&E%=*"%*%#"",DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
","",&06DA&E#B*#"*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
=,"",&06DA&E#/*#"*%##,DD*
-
7/24/2019 SGBD Oracle Hotel franchise database project
16/23
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
$,"=,&06DA&E#*#B*%##,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
%,"%,&06DA&E%%*#%*%#"",DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
B,"",&06DA&E#*#/*%#"%,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
,"",&06DA&E#=*#*%#"#,DD*
insert into SE45ICES6CHEC7 id6ser(ice,id6hotel,oer6start> (alues
/,"%,&06DA&E#B*#*%##,DD*
Populating the $ER"#+C&EC- table with the "#$ERT
command'
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues",",B>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues",%,$>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%,B,>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%,=,"%>insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues=,$,/>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues=,,"">
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(aluesB,/,%>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(aluesB,,=>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues$,,>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues$,"#,"B>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues,"",%=>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues,","">
-
7/24/2019 SGBD Oracle Hotel franchise database project
17/23
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues/,=,"/>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues/,$,%%>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues,/,%$>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues,,>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues,"",>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues,%,/>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"#,B,%=>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>(alues"#,,$>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"",,>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"","#,>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"%,",/>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"%,B,>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"=,/,"">
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"=,"#,"$>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"$,%,"B>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"$,$,/>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues",,>insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues","",=>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"/,=,>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues"/,,"=>
-
7/24/2019 SGBD Oracle Hotel franchise database project
18/23
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues",,"%>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues",","$>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues",$,"#>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues",,%#>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%#,%,%B>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%#,,"=>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%","#,"$>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>(alues%",=,"/>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%%,/,/>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%%,"",>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%=,=,"#>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%=,$,"=>
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%$,,%">
insert into SE45IN6CHEC7customer6id, id6ser(ice,utilisation6no>
(alues%$,/,B>
E.amples o/ interogations
%sing aggregate /unctions, +R%P 0*, &A"#+
22Dis!lay the name of the customer )ho consumed ser(ices in
(alue of at least %$#
-
7/24/2019 SGBD Oracle Hotel franchise database project
19/23
select c*customer6name, sumto6numberr*utilisation6no>Js*!rice>
from customers c, ser(in'6chec1 r, ser(ices s
)here s*id6ser(iceKr*id6ser(ice and c*customer6idKr*customer6id
'rou! by c*customer6name
ha(in' sumto6numberr*utilisation6no>Js*!rice>L%$#
22Dis!lay the name of the customers and the total number of ser(ices
solicitations if it )as 'reater than "B
select c*customer6name, sumto6numberr*utilisation6no>> as M;tilisation
timesM
from customers c, ser(in'6chec1 r, ser(ices s
)here s*id6ser(iceKr*id6ser(ice and c*customer6idKr*customer6id'rou! by c*customer6name
ha(in' sumto6numberr*utilisation6no>>L"B
%sing %#"#, )"#%$, "#TER$ECT
11Dis!lay the name of the clients )hich chec1ed in in Sibiu and of
those chec1ed in in 0radea usin' ;NI0N o!erator
select c*customer6name
from customers c, hotels h, clients r
)here c*customer6idKr*customer6id and r*id6hotelKh*id6hotel and
h*cityKSibiuunion
select c*customer6name
from customers c, hotels h, clients r
)here c*customer6idKr*customer6id and r*id6hotelKh*id6hotel and
h*cityK0radea
-
7/24/2019 SGBD Oracle Hotel franchise database project
20/23
22Dis!lay all the em!loyees that )or1 in 9ucuresti e.ce!t those
)or1in' at the Phoenihia %##
%sing the CA$E statement
22Increase the !rice of the
-
7/24/2019 SGBD Oracle Hotel franchise database project
21/23
select name6ser(ice, case )hen name6ser(iceK
-
7/24/2019 SGBD Oracle Hotel franchise database project
22/23
create se-uence se-uence6sstart )ith "increment by "
ma.(alue $$nocycle
Jdelete it afterdro! se-uence se-uence6s
&ierarchical 4ueries (C##ECT 0*, PR"R,LEEL, $*$C##ECT0*PAT&!
22Create the HIE4A4CH? table )ith the attributes id6em!loyee,id6mana'er
C4EA&E &A93E HIE4A4CH?id6em!loyee number=> constraints id6em!loyee6!l P4I,id6mana'er number=>>
22Insert (alues in the HIE4A4CH? table
insert into HIE4A4CH? (alues"#",insert into HIE4A4CH? (alues"#%,Preda Alin,"#">insert into HIE4A4CH? (alues"#=,Po!a Emilia,"#%>insert into HIE4A4CH? (alues"#B,insert into HIE4A4CH? (alues""",Chiaburu Ale.,"#$>insert into HIE4A4CH? (alues""%,Farmache Ana,"#B>insert into HIE4A4CH? (alues""=,Predoiu
22Dis!lay the em!loyees subordinated to the root
select id6em!loyee, name, id6mana'er
-
7/24/2019 SGBD Oracle Hotel franchise database project
23/23
from HIE4A4CH?connect by !rior id6em!loyeeKid6mana'erstart )ith u!!ername>K