How can I write this code SQL | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I write this code SQL

Write a query to output the apartments whose prices are greater than the average and are also not rented, sorted by the 'Price' column

22nd Sep 2021, 6:12 AM
Badar Adam Taha
Badar Adam Taha - avatar
3 Answers
0
Badar Adam (‫بدر ادم‬‎) first get average of 'not rented' appartments then compare average with prices, if prices are greater than average then display results and results should be sorted by 'Price' column.
22nd Sep 2021, 7:46 AM
A͢J
A͢J - avatar
0
Select * From apartments Where price > (select Avg (price) from apartments) And status = ‘Not rented’ Order by price;
22nd Sep 2021, 1:38 PM
Kazi
Kazi - avatar
0
Not working
2nd Oct 2021, 4:45 AM
Badar Adam Taha
Badar Adam Taha - avatar