Hi, i could really use help with this assignment!! anyhelp would be apperciated.
ID: 3771865 • Letter: H
Question
Hi, i could really use help with this assignment!! anyhelp would be apperciated.THANKS
Need help with the SQL statements.
Implement the table structure based on the ERD developed in phase-2. Assume property details (type, area, list price, sale price …etc). Assume 3% commission on all transactions.
Write the SQL code to create the needed tables. Ensure all primary keys, foreign keys and constraints are defined.
After implementing the table structures, insert dummy data for 25 transactions, placed between January-1-2015 and June-30-2015.
Step 4
To validate the data model you have developed in phase-3, you are asked to write some queries and verify the results with expected results.
Write the SQL statements that provide the following information:
Number of sales for the period March-1-2015 to March-31-2015
Agent who sold the most number of properties between Feb-1-2015 to June-30-2015.
Agent who sold the most $$ value of properties between Jan-1-2015 to Mar-31-2015.
Most expensive property sold between Jan-1-2015 to June-30-2015.
Explanation / Answer
1. Select count(*) as Number of Sales from Sale where SaleDate between March-1-2015 and March-31-2015
2. select top 1 Count(AgentPersonId), AgentPersonId from Sale where SaleDate between Feb-1-2015 and June-30-2015 group by AgentPersonId order by Count(AgenPersonID);
3. Select top 1 sum(Price), AgentPersonId from Sale where SaleDate between Jan-1-2015 and Mar-31-2015 group by AgentPersonId order by Sum(Price)
4. Select max(price), PropertyId from sale where SaleDate between Jan-1-2015 and June-30-2015
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.