0
How do I solve this I keep getting an Error
SELECT * FROM Apartment WHERE (price > AVG(Apartment)) AND status = 'Not rented'; ORDER BY price ASC
6 Answers
+ 2
Your code do not seem error
+ 2
The query you provided has an error. You are missing a column name to compare with in the AVG function.
To fix the error, you need to specify the column name in the AVG function. Assuming that the column name for price is "price", the corrected query should look like this:
SELECT * FROM Apartment
WHERE (price > (SELECT AVG(price) FROM Apartment)) AND status = 'Not rented'
ORDER BY price ASC;
This modified query should return all apartments that are not rented and have a price greater than the average price of all apartments in the table sorted in ascending order according to their price.
0
It took took me 6weeks to solve this but to no avail
0
Also can an SQL database automatically update itself
0
It says AVG does not exist
0
Have you tested it your self