320 likes | 448 Views
Douglas Properties & 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
E N D
DouglasProperties & Management MishaalAlruwaili 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
SQL Commands (Payment table) • DROP TABLE payment CASCADE CONSTRAINTS; • CREATE TABLE payment (tenant_idNUMBER(5), contract_idNUMBER(5), date_paid DATE, on_timeCHAR(1), amount_paidNUMBER(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.zip FROM tenant t, room r, property p, contract k WHERE k.room_id = r.room_id AND k.tenant_id = t.tenant_id AND r.property_id = p.property_id ORDER BY lname;
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 r WHERE r.property_id = p.property_id GROUP BY p.building_type, p.address;
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 r WHERE r.property_id = p.property_id AND r.room_id NOT IN (SELECT k.room_id FROM contract k) GROUP BY p.building_type, p.address;
SQL Query 4 • Which rooms are available in 110 Wellesey? SELECT r.room_id, r.square_footage FROM room r, property p WHERE r.property_id = p.property_id AND p.address = '110 WELLESY ST‘ AND r.room_id NOT IN (SELECT k.room_id FROM contract k);
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 k WHERE t.tenant_id = k.tenant_id AND (k.date_end - k.date_begin) = 213 ORDER BY t.lname;
SQL Query 6 • Average hourly wage of landscaping employees. SELECT TO_CHAR(AVG(hourly_wage), '$999.99') FROM landscaping_employee;
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_id FROM employee e, landscaping_employeelse WHERE e.employee_id = lse.lsemployee_id AND lse.hourly_wage= (SELECT MAX(hourly_wage) FROM landscaping_employee);
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_id FROM room r, contract c, tenant t WHERE t.tenant_id = c.tenant_id AND c.room_id = r.room_id AND t.tenant_id = 11007;
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 p WHERE t.tenant_id = p.tenant_id AND p.on_time = 'N‘ GROUP BY t.tenant_id, t.fname, t.lname;
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