Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

D. Please implement your answers in the database CPS3740_2019S on imc.qqqq.edu server. E. You have to refer to tables Staff, Hotel, Room, Booking, Guest in

D. Please implement your answers in the database CPS3740_2019S on imc.qqqq.edu server. E. You have to refer to tables Staff, Hotel, Room, Booking, Guest in database CPS3740 on imc.qqqq.edu server. F. Your SQL answer should be CREATE view vHW1_#_xxxx as SELECT ......., where # is the question number, xxxx is your Kean email ID, and SELECT ....... is your answer. G. Your view name and table name must be EXACTLY the same as the requirement. H. Please view your answers online at http://imc.kean.edu/students. I. If your SQL code is working, you dont need to write the SQL statements on the paper. J. If the SQL code is NOT working, please write the SQL statement and the result on the back of this paper so you can get partial credits. You will receive maximum 50% of the point.

1. (10 pts) Create a view vHW1_1_xxxx listing the first name, salary for the staff who is male and position is Manager. 2. (10 pts) Create a view vHW1_2_xxxx listing the last_name and position for staff who has e in the first_name name. The output should be alphabetically ordered from A to Z by the last_name. 3. (10 pts) Create a view vHW1_3_xxxx listing the number of female staff working at city London. 4. (10 pts) Create a view vHW1_4_xxxx showing the unique hotel name and the price for the hotel that has the most expensive room among all the hotels and all room types. 5. (10 pts) Create a view vHW1_5_xxxx listing staff first name, position and their manage first names and positions for all male staff. The output header needs to distinguish between staff and manger. 6. (10 pts) Create a view vHW1_6_xxxx listing the branch city that has at least two staff working in the branch; 7. (15 pts) Create a view vHW1_7_xxxx listing the guest name, number of days and the amount each guest needs to pay to the hotels for their stays. Your result should not include any unknown value in the date to. Your result should include guest name, hotel name, number of days, and amount to pay. 8. (15 pts) Create a table Money_xxxx with the following fields and constraints. * mid: int primary key auto_increment, code varchar(50) unique, cid: int, type: char(1), amount: float, mydatetime: datetime, note: varchar(255) * All fields cannot have NULL values, except note. * mid is the primary key, and the value should be auto increment by the DBMS. * cid is a foreign key references to the id field in CPS3740.Customers table. * code should be unique. * sid is a foreign key references to the id field in CPS3740.Sources table 9. (10 pts) Please insert 4 transactions into your money table with the following information. a. Use only cid=1 for the homework 1 b. type D: deposit, W: withdraw c. mydatetime the date and time when you insert the record. d. note Manually inserted for homework 1 e. Insert two deposits and two withdraws. f. Amount - a negative number for the W (withdraw), and a positive number for D (deposit). g. The 4 transactions should have different codes. h. The balance (the sum of the amounts) should not be negative for any customer.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

Design a training session to maximize learning. page 296

Answered: 1 week ago

Question

Design a cross-cultural preparation program. page 300

Answered: 1 week ago