0

Did anybody solve the "Apartmebts" code project in SQL course?!

It gives me.back some.mistakes. i think i need your help :)

12th Jan 2022, 10:17 PM
Dengiz Edreneli
10 Respuestas
+ 2
Thats because you cannot compare the value in a cell to that of an arbitrary value unless it is equal. For the price, for have to say: WHERE price>(SELECT AVG(price) from Apartments) That should work
12th Jan 2022, 10:33 PM
Kamil Hamid
Kamil Hamid - avatar
+ 1
select * from Apartments where price > AVG(price) and status = 'Not rented' order by price;
12th Jan 2022, 10:28 PM
Dengiz Edreneli
+ 1
SELECT * FROM Apartments WHERE price > (SELECT AVG(price) FROM Apartments) ORDER BY price;
22nd May 2022, 8:29 PM
INGO LERCH
INGO LERCH - avatar
0
Please show your attempt. I have done it fine
12th Jan 2022, 10:25 PM
Kamil Hamid
Kamil Hamid - avatar
0
select * from Apartments where price > AVG(price) and status = 'Not rented' order by price;
12th Jan 2022, 10:28 PM
Dengiz Edreneli
0
It worked mate. Thank you very much for clearance of it.
12th Jan 2022, 10:36 PM
Dengiz Edreneli
0
No problem
12th Jan 2022, 10:36 PM
Kamil Hamid
Kamil Hamid - avatar
0
Also, slight rewording of the reason, it’s because the average is not a set value, its dependant on the table, and so a custom column have to be created for comparison
12th Jan 2022, 10:37 PM
Kamil Hamid
Kamil Hamid - avatar
0
Hm i see. Thanks a lot friend. Thats lots of help
12th Jan 2022, 10:38 PM
Dengiz Edreneli
0
:D
12th Jan 2022, 10:39 PM
Kamil Hamid
Kamil Hamid - avatar