Please give the ans and explanation for SQL Filtering, Functions, Subqueries Code project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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

15th Aug 2022, 3:10 PM
Rubain M Riyam
Rubain M Riyam - avatar
3 Answers
+ 1
select avg(price) from apartments where status = 'Not rented' and ... https://code.sololearn.com/cYsGY4y3pD71
15th Aug 2022, 9:43 PM
SoloProg
SoloProg - avatar
+ 1
select price avg(price) won't work, try this instead select avg(price) from apartments and status = 'Not rented'
15th Aug 2022, 3:16 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
select * from Apartments where price > (select avg(price) from Apartments) and status = 'Not rented'
16th Aug 2022, 4:35 PM
SAID ZGHARI