Estate Agency Q1

An estate agency makes details of the properties that is has for sale available to potential customers through a website. The details of the properties and other data that are useful to the agency are stored in a relational database.

The individual web pages about specific properties that a customer can view are generated dynamically by a program from the data in the database.

A client-server system which uses CRUD and REST is used to provide tails of properties in a web page that is being viewed in a web browser on a client computer.

Figure 3 shows the structure of the relations in the database.

Figure 3

Property(PropertyID, HouseNum, Street, Area, Postcode, Bedrooms, Bathrooms, AskingPrice, SellerID)

Seller(SellerID, Title, Forename, Surname, Telephone)

Buyer(BuyerID, Title, Forename, Surname, Telephone, DesiredArea, MinBedrooms, MaxPrice)

Viewing(BuyerID, PropertyID, ViewingDate, ViewingTime)

Sale(SaleID, PropertyID, BuyerID, SalePrice)

Question

Write an SQL query that will retrieve from the database the list of all properties that the buyer with BuyerID 23 might be interested in buying. The properties should:

The list of properties returned should only include, for each property, the following:

The list should be ordered with most expensive property at the top of the list and the least expensive at the bottom.