New course! Every coder should learn Generative AI!
Try a free lesson0
Please give the ans and explanation for SQL Filtering, Functions, Subqueries Code project
hi I am trying to solve SQL Filtering, Functions, Subqueries Code project I am trying my best but I can't find the answer this is my current code: select * from Apartments where price > (select price avg(price) from Apartments and status = 'Not rented') but it gives me this error "ERROR: syntax error at or near "(" LINE 2: where price > (select price avg(price) from Apartments and s..." can any of you please help me fix this and please explain the code
3 Answers
+ 1
select avg(price)
from apartments
where status = 'Not rented'
and ...
https://code.sololearn.com/cYsGY4y3pD71
+ 1
select price avg(price) won't work, try this instead
select avg(price) from apartments and status = 'Not rented'
+ 1
select * from Apartments
where price > (select avg(price) from Apartments) and status = 'Not rented'