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

4th Apr 2023, 3:59 AM
ARBEIT MANN
ARBEIT MANN - avatar
6 Answers
+ 2
Your code do not seem error
4th Apr 2023, 8:12 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
+ 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.
5th Apr 2023, 2:37 AM
Z3ro
0
It took took me 6weeks to solve this but to no avail
4th Apr 2023, 4:00 AM
ARBEIT MANN
ARBEIT MANN - avatar
0
Also can an SQL database automatically update itself
4th Apr 2023, 4:00 AM
ARBEIT MANN
ARBEIT MANN - avatar
0
It says AVG does not exist
4th Apr 2023, 3:53 PM
ARBEIT MANN
ARBEIT MANN - avatar
0
Have you tested it your self
5th Apr 2023, 10:09 AM
ARBEIT MANN
ARBEIT MANN - avatar