Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. (10 pts) Create a view vHW1_2_xxxx listing the first name, last name and salary for staff who has last name ending with 'e'. The

image text in transcribed

2. (10 pts) Create a view vHW1_2_xxxx listing the first name, last name and salary for staff who has last name ending with 'e'. The output should be alphabetically ordered from high to low by the salary. Your output header should be (first_name, last_name, salary) 3. (10 pts) Create a view vHW1_3_xxxx listing the number of staff and the average salary for whom are in Assistant position and work at city London. The output header should be count, average_salary. 4. (10 pts) Create a view vHW1_4_xxxx showing the unique hotel name, room type and the price for the hotel that has the cheapest room among all the hotels and all room types. 5. (10 pts) Create a view vHW1_5_xxxx listing the first name, position and their manage first names and positions for all female staff in Assistant position. The output header needs to distinguish between staff and manger. 6. (10 pts) (10 pts) Create a view vHW1_6_xxxx listing the city that has only one female staff working in the city. Your out header should be (city, count). 7. (10 pts) Create a view vHW1_7_xxxx listing staff who have the highest salary in each of the branch city. You will need both Staff and Branch table. The output header should be (branchno, city, first_name, last_name, salary) 8. (10 pts) Create a view vHW1_8_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 dateto. Your result should include guest name, hotel name, number of days, and amount to pay. 9. (10 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 10. (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 Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions