Question

Views PROPERTY [pid, stno, stname, sttype, suburb, state, postcode, carspaces] Write the following queries in SQL in your PROQuery #4 Please

"Which street in the suburb Camperdown has the highest average rent"

in LISTING, the "type" column determines if it is "rent" or "sell"

Thankyou

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Select stname FROM

(SELECT p.stname,AVG(l.price) AS AvgPrice From Property p INNER JOIN Listing l ON p.pid=l.pid WHERE P.suburb='Camperdown' and l.type='rent' GROUP BY p.stname) As SubQueryTable WHERE AvgPrice= (Select Max(AvgPrice) From

(Select p.stname,Avg(l.price) As AvgPrice From property p inner join listing l on p.pid=l.pid where p.suburb='Camperdown' and l.type='rent' group by p.stname) As SubQueryTable2);

To get Max avg price street we have used subquery table. And filter data with help of where clause. Please comment if you see any errors while executing query.

Add a comment
Know the answer?
Add Answer to:
Query #4 Please "Which street in the suburb Camperdown has the highest average rent" in LISTING,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT