Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!