0

SQL Apartments

Hello, I tried this query: https://pastebin.com/1AjhN55R The output is: id,city,address,price,status Where is my mistake?

17th Feb 2021, 4:38 AM
Anis Ali Khan
9 Réponses
+ 19
Here is my code You can try it. It surely help you. SELECT * FROM Apartments WHERE price>=(SELECT AVG(price)FROM Apartments) ORDER BY price;
18th Feb 2021, 1:42 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 3
Anis Ali Khan Problem is with SQL Compiler not your script. https://www.sololearn.com/post/935054/?ref=app
17th Feb 2021, 5:33 AM
A͢J
A͢J - avatar
+ 2
My code SELECT * FROM Apartments WHERE price > (SELECT AVG(price) FROM Apartments AND status != ‘Rented’ ORDER BY price;
5th May 2021, 9:16 PM
Łukasz Śmietanka
Łukasz Śmietanka - avatar
0
Happy coding
18th Feb 2021, 1:46 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
0
Most welcome 👍
22nd Feb 2021, 1:11 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
0
❤️😍Prerana😍❤️ It tells you to also account for status being "Not Rented". I know it turns out that you don't need to include it but if I had to what would it look like?
2nd May 2022, 2:45 AM
Dylan Campbell
Dylan Campbell - avatar
- 1
thank you. I also had to delete the second subcondition.
18th Feb 2021, 1:45 AM
Anis Ali Khan
- 1
Most welcome 👍
18th Feb 2021, 1:46 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
21st Feb 2021, 10:19 PM
Enrique Arias
Enrique Arias - avatar