+ 1
Why this code is not right in SQL apartment quiz?
SELECT * from apartments where ( price > ( Select avg(price) from apartments ) ) and ( status = 'Not Rented' ) order by price;
10 Réponses
+ 3
Agyad Keddeh
Try this:
SELECT * FROM Apartments
WHERE price>=(SELECT AVG(price)FROM Apartments)
ORDER BY price;
+ 5
Your solution seems to be correct.
You can also try this in this way:
SELECT * FROM apartments where price > ( SELECT AVG(price) from apartments ) and status='Not rented' order by price;
I think you are getting problem due to recent bug in SQL code coaches.
Can you please upload the screenshot of your output and expected output?
+ 2
Agyad Keddeh
I guessed correctly, it's due to a recent bug in SoloLearn, hope it will resolve soon.
Till then you can try other things
+ 2
AKSHAY🇮🇳 [INACTIVE]
Thank you very much brother 👍🏻
+ 2
❤️😍Prerana😍❤️
Your code is working my friend, thanks alot.
But why omitting the not rated condition makes it right, the quiz asked for this condition on the first place?!! 🤔
+ 2
Agyad Keddeh
Welcome
But I really don't have any idea about it.
+ 1
There may be some mistake on your database,ins.
+ 1
How can I upload a screen shot here?! I'm sorry I am new here, thanks in advance for answering me my friend
+ 1
Agyad Keddeh currently SoloLearn doesn't support sharing images in discuss section.
What you can do is post it in your feed and then share the post link here
https://www.sololearn.com/post/903/?ref=app