The following relational schema (primary keys are underlined) are used by the real estate company mostly as described in Assignment 1, with one extra specification that "When a listed property is sold, it is sold by a realtor that may or may not be same as the listing realtor". The ER diagram in Assignment 2 now reflects the extra specification.
Properties(folio, civicAddress, zoning, builtYear, description)
MajorProjects(folio, year, description)
Realtors(RID, serviceName, name, contactInfo, expLevel)
Listings(listingID, folio, listedBy, listDate, status, description, askingPrice)
ClosedListings(listingID, soldBy, closingDate, purchasePrice)
Clients(email, name, otherInfo)
Leads(email, listingID, interest)
This assignment is based on the above relational schema.
Many more details, including constraints, data types, etc, are captured in the SQL definitions of these tables.
You may use the supplied table definitions to create empty tables. You will then need to populate the tables (insert sample data) yourself in order to test your SQL queries logically.
Express each of the following queries in an equivalent
Relational Algebra query, Datalog query
and SQL query respectively
against the relational schema defined above.
(Note that your relational algebra and datalog queries
can borrow some comparison operators from SQL,
such as "is null" and "like", and functions from Oracle SQL,
such as to_date and to_char.)
You are expected to include a legend to explain your relational algebra operators used in this assignment, and to include your Datalog and SQL queries in a text file (with the extension name .txt or .sql), and to include your Relational Algebra queries in the same text file or in a separated PDF file.
Make your queries logically correct and easy to understand. Make sure that your SQL queries can be successfully executed by Oracle database engine.
You can submit your assignment solutions using one of the following two ways: