People are planning to move all the time in other to scarify their jobs or their living purpose. Because technology has changed the apartment rental experience, many renters go online and search for apartments, the majority being millennials. Millennials are recently the prime rental group in the United States. Millennials make a lot of rookie mistakes when they are looking for apartments, because they don’t consider everything there is to know. The information, which is posted through the renting sites, is very important to help the customers search for and rent a unit before they set foot in their destination. Some websites allow tenants to narrow their searches based on area, price, and number of bedrooms and baths.
1. A DATA MODEL FOR
LISTING
APARTMENTS
BY:
POOJA, ADITI, TRANG
& KAREN
2. OUR GOALS
• Manage the information from user table, unit table, parent unit table and leasing
information table
• Track for available units
• Keep the information up to date
• Create database to run the business
8. INSERT RECORD INTO UNIT TABLE
• SELECT * FROM unit;
• INSERT INTO unit
• VALUES (22, 21, 4, '2BD/2BR - The Colorado,
Newly Updated!', 2, 2, 1, '12/6/2019',
'1/1/2020', 'TRUE', 'Unit has been updated
with brand-new wood flooring throughout.
Kitchen has new granite counters and
appliances. Will not last long!')
10. INSERT RECORD INTO PARENT UNIT TABLE
SELECT * FROM mydb.parent_unit;
INSERT INTO parent_unit
VALUES(101, 6, 1, 3, 12, 1, 1, 1, 1, 1, 1)
11. INSERT DATA STORED PROCEDURE
DELIMITER |
CREATE PROCEDURE add_new_user_interested_unit (in W_User_ID
int(11), in W_Unit_ID int(11))
BEGIN DECLARE W_Parent_Unit_ID int(11);
DECLARE W_Unit_Leasing_ID varchar(50);
SELECT Leasing_Info_ID ,Parent_unit_ID INTO W_Unit_Leasing_ID,
W_Parent_Unit_ID
FROM unit WHERE ID = W_Unit_ID;
INSERT into user_interested_unit
VALUES(W_User_ID,W_Unit_ID,W_Unit_Leasing_ID,W_Parent_Unit_I
D);
END | DELIMITER ;
CALL add_new_user_interested_unit(44526,8);
SELECT * FROM user_interested_unit;
12. UPDATE DATA STORED PROCEDURE
DELIMITER |
CREATE PROCEDURE update_user_interested_unit
(in W_User_ID int(11), in W_New_User_ID int(11))
BEGIN UPDATE user_interested_unit
SET User_ID = W_New_User_ID
WHERE User_ID = W_User_ID;
END | DELIMITER ;
CALL update_user_interested_unit(7172,9841);
SELECT * FROM user_interested_unit;
13. REPORTS GENERATION
• SQL Query to show the Average Rent for short term leasing and Long Term Leasing.
• SQL Query to show the Average Rent for short term leasing and Long Term Leasing for the
Total number of Bedrooms.
• Query to display the Parent units ID that has wheelchair accessibility and Bus stop
accessibility.
• Query showing the number of Total Floors which has minimum 2 elevators in an apartment
or Unit
• Query to display the Unit Description which starts with ‘Excellent’ and ‘Great’ with their
Parent unit ID.
14. CONTINUED….
• Query to display the Sum of Admin Fee, Security Deposit, Lease Termination
Amount as Processing Cost.
• Write A SQL Query To Print All User Details From The User Table Order By
FIRST_NAME Ascending.
• Write A SQL Query To Fetch The Total number of Buildings In The Parent Unit
where Parent Unit number is ‘10’.
15. SQL QUERY TO SHOW THE AVERAGE RENT FOR SHORT TERM
LEASING AND LONG TERM LEASING
Select Leasing_Type,
AVG(Rent_for_short_term_Leasing) as 'Avg short term’,
AVG(Rent_for_long_term_Leasing) as 'Avg long term'
From leasing_info
join unit
group by Leasing_Type
16. SQL QUERY TO SHOW THE AVERAGE RENT FOR SHORT TERM LEASING AND LONG
TERM LEASING FOR THE TOTAL NUMBER OF BEDROOMS
Select Leasing_Type, Num_of_Bedroom,
AVG(Rent_for_short_term_Leasing) as 'Avg short term',
AVG(Rent_for_long_term_Leasing) as 'Avg long term'
From leasing_info li
Join unit on li.id = unit.Leasing_Info_ID
Group by Leasing_Type,Num_of_Bedroom
17. QUERY SHOWING THE NUMBER OF TOTAL FLOORS WHICH HAS MINIMUM 2
ELEVATORS IN AN APARTMENT OR UNIT.
Select Number_of_Elevators,Total_Floors,count(*)
From parent_unit
Where Total_Floors >=2
Group by Number_of_Elevators,Total_Floors
Order by count(*) desc , Total_Floors desc, Number_of_Elevators
desc
18. WRITE A SQL QUERY TO PRINT ALL USER DETAILS FROM THE USER TABLE ORDER
BY FIRST_NAME ASCENDING.
Select * from User
Order By FIRST_NAME asc;