Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this SQL statement I keep getting errors: Question: 3) Create a view vHW1_3_xxxx listing the number of staff and the average

I need help with this SQL statement I keep getting errors:

Question:

3) 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) 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.

------------

3.

Create view vHW1_3_xxxx as

-> select * from CPS3740.Staff

->select count(staffNo) as count, avg(salary) as mySum from Staff group by(position) having position ='Assistant' and city='London';

output: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'select count(staffNo) as count, avg(salary) as mySum from Staff group by(positio' at line 3

4.

mysql> Create view vHW1_4_xxxxx as

-> select * from CPS3740.Staff

-> select distinct hotel_name,room_type,min(price) from hotel group by(hotel_name,room_type);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'select distinct hotel_name,room_type,min(price) from hotel group by(hotel_name,r' at line 3

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

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions