NEED WITH THIS DATABASE QUESTIONS Need help with this data base question to rewr
ID: 3751271 • Letter: N
Question
NEED WITH THIS DATABASE QUESTIONS
Need help with this data base question to rewrite those questions
1. list the branchno and the number of female staff and the average salary for each branch. Your output header should be: branchno, count, average_salary
2. list the hotel name that has 3 different types of rooms.
3. list the hotel name, the number of different types of rooms, and the revenue if all rooms were booked for the hotels that are at London and the revenue is higher than 85. Your view header names should be: hotelname, count, revenue.
Explanation / Answer
If you have any doubts, please give me comment...
1)
SELECT branchNo branchno, COUNT(*) 'count', AVG(salary) average_salary
FROM Staff
WHERE sex = 'F'
GROUP BY branchNo;
2)
SELECT hotelName
FROM hotel H, room R
WHERE H.hotelNo = R.hotelNo
GROUP BY hotelNo, hotelName
HAVING COUNT(DISTINCT type)==3;
3)
SELECT hotelName, COUNT(DISTINCT type) 'count', SUM(price) revenue
FROM hotel H, room R
WHERE H.hotelNo = R.hotelNo AND city='London'
GROUP BY hotelNo, hotelName
HAVING SUM(price)>85;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.