2004Spring CS157 Computer Assignment 1.
Due date: April.6,2004
You are working with a Hotel database which consists of three tables.
Table HOTELS
|
HID |
NAME |
CITY |
STATE |
LUXURY |
AIRPORT_DISTANCE |
DOWNTOWN_DISTANCE |
|
1 |
Days In |
College Park |
MD |
1 |
20 |
10 |
|
2 |
Hilton |
Washington |
DC |
3 |
7 |
1 |
|
3 |
Ritz Carlton |
Washington |
DC |
4 |
6 |
1 |
|
4 |
Holiday In |
Washington |
DC |
2 |
5 |
1 |
|
5 |
Holiday In |
Washington |
DC |
1 |
7 |
1 |
|
6 |
Holiday In |
Arlington |
VI |
2 |
2 |
6 |
Table ROOMS
|
RID |
NUM |
HID |
BEDS |
PRICE |
TV |
FRIDGE |
|
1 |
25 |
1 |
1 |
80.00 |
T |
F |
|
2 |
20 |
1 |
2 |
120.00 |
T |
F |
|
3 |
100 |
2 |
2 |
200.00 |
T |
T |
|
4 |
20 |
2 |
2 |
600.00 |
T |
T |
|
5 |
40 |
3 |
2 |
999.00 |
T |
T |
|
6 |
120 |
4 |
2 |
150.00 |
T |
T |
|
7 |
120 |
4 |
1 |
120.00 |
T |
T |
|
8 |
80 |
5 |
1 |
100.00 |
T |
F |
|
9 |
90 |
6 |
2 |
140.00 |
T |
F |
Table RESERVATIONS
|
RSVID |
RID |
GUEST |
DATEIN |
DAYS |
NUM |
|
1 |
1 |
A.B. Holmes |
03-Feb-02 |
2 |
1 |
|
2 |
3 |
SIGX-conference |
03-Feb-02 |
5 |
80 |
|
3 |
4 |
King of Z |
05-Feb-02 |
7 |
1 |
|
4 |
3 |
Kings service |
05-Feb-02 |
7 |
3 |
|
5 |
5 |
D.D. A |
04-Feb-02 |
3 |
1 |
|
6 |
7 |
D.D. B |
04-Feb-02 |
1 |
1 |
|
7 |
9 |
D.D. C |
03-Feb-02 |
1 |
1 |
|
8 |
9 |
D.D. D. |
04-Feb-02 |
1 |
1 |
|
9 |
9 |
D.D. E. |
05-Feb-02 |
1 |
1 |
|
10 |
9 |
D.D. F. |
06-Feb-02 |
1 |
1 |
Use MySQL to work on the following problems:
Hints:
Remind:
1) Make sure that all data is input correctly
2) Use appropriate types!
3) Make sure that there is no extra space before or after any of the visable data
4) HID in ROOMS table refers to HID (the key) of the HOTELS table
5) RID in RESERVATIONS table refers to RID (the key) of the ROOMS table
6) NUM in ROOMS table refers to number of certain rooms in the system
7) NUM in RESERVATIONS table refers to number of rooms reserved
8) Data integrity may not be sacrificed!
How to submit the assignment?
The printout of different queries must be
submitted. Use MySQL to create and test the queries. All of your SQL
queries should be contained in a single file, which you should electronically
submit. The best way to submit this, and other SQL assignments, is to
“log” an MySQL . Copy, and then paste, parts of an output into a word document to be e-mailed as an
attachment. As always, enter your name, the course name and the assignment in
the word document.
For Section 1 send to cs157a1@yahoo.com
Section 2 send to cs157a2@yahoo.com