Question
Consider the following relational schema (the primary keys are underlined): homebuilder (hID, hName, hStreet, hCity, hZip, hPhone) PRIMARY KEY = hID model (hID, mID, mName,
Consider the following relational schema (the primary keys are underlined):
homebuilder(hID, hName, hStreet, hCity, hZip, hPhone) PRIMARY KEY = hID
model(hID, mID, mName, sqft, story) PRIMARY KEY = hID,mID
subdivision(sName, sCity, sZip) PRIMARY KEY = sName
offered(sName, hID, mID, price) PRIMARY KEY = sName,hID,mID
lot(sName, lotNum, lStAddr, lSize, lPremium) PRIMARY KEY = sName,lotNum,ISTAddr
sold(sName, lotNum, hID, mID, status) PRIMARY KEY = sName,lotNum,ISTAddr
Write the first five queries in (a) Relational Algebra, (b) Tuple Relational Calculus, (c) Domain Relational Calculus and (d) SQL. Write the last five queries in (a) Relational Algebra and (b) SQL.
1. List the zip codes of the subdivisions that only offer single-story homes.
2. List all the subdivisions in Atlanta who offer single-story models with larger than 2000 square feet.
3. List the addresses of the available (i.e., not sold) lots in the SweetWater subdivision.
4. Which models are not sold in any subdivision?
5. List the subdivisions who offer models from only one homebuilder.
6. Which models are offered in more than one subdivision?
7. Which models sold in the HighSky subdivision has the maximum square footage?
8. Which subdivision offers all the models by the homebuilder located in Atlanta?
9. For each subdivision, find the number of models sold and the average, minimum and maximum price of the models sold at that subdivision. Display the result in ascending order on the average price of a home.
10. For each subdivision, find the total of lot premiums for lots that has the model with model ID 1. Display the result in descending order on the total of lot premiums.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started