Date post: | 29-Mar-2015 |
Category: |
Documents |
Upload: | layton-wigglesworth |
View: | 213 times |
Download: | 0 times |
DOUGLASPROPERTIES & MANAGEMENT
Mishaal Alruwaili
Spencer Lauber
Linh Vu
Project Description
Housing company that operates in Spokane, WA South Hill, North Hill, Logan, Riverside
Large number of properties that include residential spaces including: Standalone houses Apartment complexes Townhouses
Project Description
Douglas Properties & Management has lease agreements for each room in each house/apartment Keeps track of all the individual tenants in
the units
Project Objectives
Due to the complexity of Douglas’s information, we have designed a database model that increases the effectiveness and efficiency of managing data Increase efficiency in viewing the properties and
maintaining all units in each property Easily track renters’ information including
location, payments
Differentiate Douglas form other competitors in the housing industry
System Development Life Cycle Analysis Design: Three major parts
Tenant Property Employee
Implementation Tenant, Payment, Contract Property, Room Employee (Administrative, Landscaping) (Look-up tables: Neighborhood, Neighborhood
Properties) Maintenance
Continuously add more data to the database immediately after any changes
ERD Model TENANT & PROPERTIES
EMPLOYEE & LOOK-UP TABLES
Third Normal Form
SQL Commands (Payment table)
DROP TABLE payment CASCADE CONSTRAINTS; CREATE TABLE payment
(tenant_id NUMBER(5),contract_id NUMBER(5),date_paid DATE,on_time CHAR(1),amount_paid NUMBER(6,2),CONSTRAINT payment_cpk PRIMARY KEY (Tenant_ID, Contract_ID, Date_Paid),CONSTRAINT payment_On_Time_ck CHECK (On_Time IN ('Y','N')),CONSTRAINT payment_contract_id_fk FOREIGN KEY (contract_id)REFERENCES contract (contract_id),CONSTRAINT payment_tenant_id_fk FOREIGN KEY (tenant_id) REFERENCES tenant (tenant_id));
SQL Commands (Payment table)
INSERT INTO payment(tenant_id,contract_id,date_paid,on_time,amount_paid)
VALUES ('11001', '22001', '01-JUN-2013', 'Y', '400');
SQL Query 1
Listing of all our tenants addresses to send them a notice of inspection
SELECT t.fname, t.lname, k.room_id, p.address, p.city, p.state, p.zipFROM tenant t, room r, property p, contract kWHERE k.room_id = r.room_idAND k.tenant_id = t.tenant_idAND r.property_id = p.property_idORDER BY lname;
SQL Query 1 ResultFNAME LNAME ROOM_ID ADDRESS CITY ST ZIP
KELLY ALDERMAN 10086 560 UPLAND WY SPOKANE WA9920
9
SERAFINA BUI 10078 110 WELLESY ST SPOKANE WA9920
9
MUI CHAN 10095 550 PORTOLA AVE SPOKANE WA9925
8
JIAYU CHEN 10057 992 GRAND AVE SPOKANE WA9920
3
GREG CHU 10003 229 BALDWIN AVE SPOKANE WA9920
7
JAY CHUI 10067 4500 DIVISION ST SPOKANE WA9920
9
KENDRA COCKERHAM 10080 110 WELLESY ST SPOKANE WA9920
9
TIM DO 10055 201 LAMONTE ST SPOKANE WA9920
3
FRANCIS GO 10060 992 GRAND AVE SPOKANE WA9920
3
QUYEN HA 10001 229 BALDWIN AVE SPOKANE WA9920
7
CRYSTAL HARTLEY 10056 201 LAMONTE ST SPOKANE WA9920
3
KELSEY HOOD 10022 1020 SINTO AVE SPOKANE WA9920
7
LERA HUAN 10045 428 AUGUSTA AVE SPOKANE WA9920
7
ANAS HUSSAIN 10087 560 UPLAND WY SPOKANE WA9920
9
SQL Query 2
Number of rooms in each building and the type of building.
SELECT p.address, p.building_type, COUNT(r.room_id) "NUMBER_OF_ROOMS“FROM property p, room rWHERE r.property_id = p.property_idGROUP BY p.building_type, p.address;
SQL Query 2 Result
ADDRESS BUILDING_TYPE NUMBER_OF_ROOMS
992 GRAND AVE APARTMENTS 8
4500 DIVISION ST APARTMENTS 9
560 UPLAND WY STAND-ALONE 4
550 PORTOLA AVE STAND-ALONE 2
428 AUGUSTA AVE APARTMENTS 11
229 BALDWIN AVE STAND-ALONE 4
201 LAMONTE ST STAND-ALONE 3
110 WELLESY ST APARTMENTS 12
4545 SUPERIOR DR APARTMENTS 10
780 FULTON ST STAND-ALONE 3
450 MOANA WY STAND-ALONE 4
808 NORA AVE STAND-ALONE 5
1020 SINTO AVE APARTMENTS 15
455 37TH AVE STAND-ALONE 2
SQL Query 3
Number of rooms still available in each building.
SELECT p.address, p.building_type, COUNT(r.room_id) "AVAILABLE_ROOMS“FROM property p, room rWHERE r.property_id = p.property_idAND r.room_id NOT IN
(SELECT k.room_idFROM contract k)
GROUP BY p.building_type, p.address;
SQL Query 3 Result
ADDRESS BUILDING_TYPE AVAILABLE_ROOMS
4500 DIVISION ST APARTMENTS 5
992 GRAND AVE APARTMENTS 6
560 UPLAND WY STAND-ALONE 2
428 AUGUSTA AVE APARTMENTS 10
110 WELLESY ST APARTMENTS 8
229 BALDWIN AVE STAND-ALONE 2
4545 SUPERIOR DR APARTMENTS 9
450 MOANA WY STAND-ALONE 4
780 FULTON ST STAND-ALONE 1
1020 SINTO AVE APARTMENTS 12
808 NORA AVE STAND-ALONE 4
408 INDIANA DR STAND-ALONE 2
SQL Query 4
Which rooms are available in 110 Wellesey?
SELECT r.room_id, r.square_footageFROM room r, property pWHERE r.property_id = p.property_idAND p.address = '110 WELLESY ST‘AND r.room_id NOT IN
(SELECT k.room_id FROM contract k);
SQL Query 4 Result
ROOM_ID SQUARE_FOOTAGE
10082 160
10083 170
10076 160
10074 150
10075 140
10084 120
10077 140
10079 150
SQL Query 5
Renters who has a half year contract
SELECT t.lname || ', ' || t.fname "NAME", t.tenant_id AS "TENANT_NUMBER“FROM tenant t, contract kWHERE t.tenant_id = k.tenant_idAND (k.date_end - k.date_begin) = 213ORDER BY t.lname;
SQL Query 5 Result
NAME TENANT_NUMBER
CHAN, MUI 11025
CHEN, JIAYU 11011
CHU, GREG 11017
DO, TIM 11014
GO, FRANCIS 11022
HA, QUYEN 11003
HARTLEY, CRYSTAL 11012
HUSSAIN, ANAS 11007
JASSEM, FAHAD 11004
KIM, ROBIN 11016
PETERSON, JASON 11015
SIPP, TINA 11021
STOREBO, JAKE 11008
TIUR, GRACE 11026
SQL Query 6
Average hourly wage of landscaping employees.
SELECT TO_CHAR(AVG(hourly_wage), '$999.99') FROM landscaping_employee;
SQL Query 6 Result
AVERAGE HOURLY WAGE
$13.12
SQL Query 7 Which Landscaping employee makes the
highest hourly wage among all other employees, and in which neighborhood is he/she assigned to?
SELECT DISTINCT e.employee_id, e.fname, e.lname, TO_CHAR(lse.hourly_wage, '$999.99'), lse.neighborhood_idFROM employee e, landscaping_employee lse WHERE e.employee_id = lse.lsemployee_idAND lse.hourly_wage =
(SELECT MAX(hourly_wage)FROM landscaping_employee);
SQL Query 7 Result
EMPLOYEE_ID FNAME LNAME HOURLY WAGE NEIGHBORHOOD_ID
17 JENETTE JEFFERIES $17.80 4
SQL Query 8
Name, monthly rent and contract id of tenant who lives in room 11007
SELECT r.room_id, t.fname, t.lname, t.tenant_id, TO_CHAR(c.monthly_rent_due, '$999.99'),
c.contract_idFROM room r, contract c, tenant tWHERE t.tenant_id = c.tenant_id AND c.room_id = r.room_idAND t.tenant_id = 11007;
SQL Query 8 Result
ROOM_ID FNAME LNAME TENANT_ID RENT_DUE CONTRACT_ID
10087 ANAS HUSSAIN 11007 $400.00 22007
SQL Query 9
List all tenants who have made a late payment, includes: id, names, number of late payments they have made
SELECT DISTINCT t.tenant_id, t.fname, t.lname, COUNT(on_time) AS "# OF LATE PAYMENTS" FROM tenant t, payment pWHERE t.tenant_id = p.tenant_idAND p.on_time = 'N‘GROUP BY t.tenant_id, t.fname, t.lname;
SQL Query 9 Result
TENANT_ID FNAME LNAME # OF LATE PAYMENTS
11013 JANEAL JAMES 1
11027 CAMERON LEA 2
11005 TOMOMI SAKATA 1
11006 CELINA OH 2
11008 JAKE STOREBO 1
11011 JIAYU CHEN 2
11028 KENDRA COCKERHAM 2
11004 FAHAD JASSEM 1
11007 ANAS HUSSAIN 2
11010 JAY CHUI 1
11022 FRANCIS GO 1
11009 KELLY ALDERMAN 1
11021 TINA SIPP 1
11020 KIERRA IRVIN 1
Managerial and organizational impacts
Making Douglas Properties & Management operations run much more efficiently Improve the ease and relevance of data
retrieval Efficiently analyze historical data to find out
important information Manage the company more efficiently
Conclusion
Have a chance to experience a real life example of interacting with a decent sized database system
Teamwork Minimize conflicts in data entry stage Time saving Minimize database anomalies
Encounter several challenges because of transitive dependencies
Questions ?