Answered step by step
Verified Expert Solution
Question
1 Approved Answer
11. Consider the following data model and sample data (not all data is shown) for a student real-estate system. At any given time, an individual
11. Consider the following data model and sample data (not all data is shown) for a student real-estate system. At any given time, an individual property is empty or occupied by one tenancy. Note that the rent charged for a particular tenancy, especially one in the past, may be different to the current advertised rent on that property. Tenant id Property id propertytype given Name Tenancy tenant property dateStart datend rent surname phone unitum propertynum Property Type id description rent street suburb postcode subtypes: disjoint, total : Apartment House Pid Shared tid Pid contactName num Bedrooms num Bedrooms num Car Spaces contactPhone id 1 2 3 4 4 Tenant Property dateStart date End rent 92 5 5 2014-08-09 NULL 429 160 13 2014-04-23 2016-04-22 362 153 39 2014-01-11 2015-01-11 339 48 42 2014-05-25 2015-05-25 291 93 48 2014-06-14 MULL 314 79 49 2014-02-18 2015-02-18 517 36 51 2014-01-05 2015-01-05 395 132 51 2014-08-11 HULL 425 6 82 2014-06-06 2015-06-06 384 86 123 2014-04-07 2015-04-07 458 109 133 2014-03-30 2015-03-30 534 givenName surname phone Britteny Abston 0441532370 Margy Alter 0810478134 Freida Amaral 072681647 Kera Anderson 0266223748 Barbra Basham 0353849916 Lon Batchelor 0924374652 Heide Belew 0987544272 Susan 083194347 Ouida Binion 0599985340 Wal Bisceglia 0606937760 5 5 6 7 8 Bergen 9 10 id unitnum NULL 1 H Property Type rent 394 404 540 INULL Fitzroy 2 2 3 HULL H 68 4 NULL H 48 590 429 5 H MULE propertynum street suburb postcode 39 Napier lane Fitzroy 3065 97 Charles place 3065 Harrison place Fitzroy 3065 Royal lane Fitzroy 3065 38 Johnston street Fitzroy 3065 45 Rodney place Carlton 3053 12 Bouverie street Carlton 3053 26 Kerr street Fitzroy 3065 93 Highett place Fitzroy 3065 90 Charles place Fitzroy 3065 6 A 374 4 MULL 7 586 id 8 S NULL 107 378 description Apartment House Shared 9 H H 4 NULL 10 s 171 S id id id contactPhone numBedrooms 2 3 1 numBedroms numCar Spaces 1 2 6 8 10 2 9 1 1 8697660699 1597228831 2319846495 8566163983 3 4 12 1 0 16 4 4 15 1 2 20 5 3 21 1 28 contactName Finley Jovanny Deborah Dean Stanley Krish Haiden Alvaro Dylan Destiny 1 1 2 9176265253 7 4 24 52 4854635066 1 1 2 2 11 3 30 2 64 13 2 33 1 1 0 76 14 3 6938385335 7457141435 6118526965 7316239255 36 1 1 0 88 17 3 39 1 1 1 106 Questions A-D require you to write SQL statements. Your code should be formatted so it is easy to understand. Ensure user friendly output by displaying and sorting on appropriate fields and naming fields appropriately. A) Which tenants have paid us the most rent? List the top 5 payers, and how much rent each has paid in total. B) What is the longest given name among our tenants? If several names tie for first place, list them all. C) List the addresses of the houses and apartments which only have one bedroom. D) List the names of tenants who have rented at least two different types of properties
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