0% found this document useful (0 votes)
60 views84 pages

DBMS Report

Uploaded by

kotwaniv03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views84 pages

DBMS Report

Uploaded by

kotwaniv03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

CSE250: Database Management Systems

Project Report

Project Title: Property Management System

Submitted to: Professor Shefali Naik


Semester: Winter Semester 2024
Section: 2

Group Members:

Enrolment Number Name


AU2240069 Aryan Sukhadia
AU2240011 Het Naik
AU2220195 Varun Kotwani
Project Description (System Requirement Specifications)

Real estate is a growing business in India and is a significant sector which plays a
crucial role in the country’s economy. Daily, a large number of property dealings
are happening in India. In this, you have to keep track of a lot of data like
properties sold, rented, bought, customer and seller details and details of financial
transactions.

We have designed a database management system for property dealers to help them
easily store data. Other than storing it will also allow you to insert new data or
modify the existing data easily. The data will be stored safely and can be retrieved
in the least amount of time. The database will contain details of all sellers, buyers,
agents, properties sold or rented, and transactions.

We will act like middlemen between buyers and sellers. Buyers can view all the
properties in Ahmedabad and Gandhinagar that are available for sale or rent on our
website along with their selling price or the rent. They will also be able to see the
images of the properties and all the amenities. They can also plan a meeting with
our agents for further details online or offline at their convenience.
Tech Stack used in making Property Management system:

● Frontend:
1. Html
2. CSS
3. JavaScript

● Backend:
1. Node JS
2. Postman API
3. Express JS
● Database:
1. MYSQL
2. AIVEN CLOUD
Functionalities present in our Property Management System

1. Calculate_RENT: This function will calculate and return rent of any


property. It will take Rent_id as a parameter and will calculate the rent of the
property associated with the given Rent_id. It will calculate rent for 30 days
as per the formula:

Rent= (Rent_per_day*30) + Additional_charges

2. GetPropertyDetails: This function will take Property_id as the input and


will return a list containing details about that property. The list will include
details like House_number, Society_name, area, city, state, number of
bedrooms, bathrooms and balconies, google_location, images of that
property. It will also give details about the amenities like cultural and
recreational opportunities, transportation and mobility, education,
environment quality and access to various services.

3. AddMoney: This function will add a given amount of money and will return
the new balance of the user. It will take User_id and amount as input
parameters. It will fetch the current balance of the user and add the amount
given in the input to that current balance and calculate the new_balance as
per the formula:

new_balance= current_balance + amount

4. DeductMoney: This function will deduct a given amount of money from the
user’s balance and will return the new balance. It will take User_id and
amount to be deducted as the input parameters. It will fetch the current
balance and check that current_balance > amount to be deducted. If the
current balance is greater then the function will return a message: “Amount
deducted successfully” and the new_balance. But if the current_balance is
less then it will return a message: “Insufficient balance. Deduction failed”.

new_balance= current_balance - amount

5. GetAverageRating: This function will calculate and return the average


rating of any user. It will take User_id as the input parameter and will
calculate the average rating of that user.

Stored Procedures

1. GetUserTransactions: This procedure will display details about the


transactions made by a user. It will take User_id as input and will display
details like T_id, payer, payee, amount, status of the transactions made by
the user. If the user hasn’t made any transaction then the procedure will
display a message: “No transactions found.”

2. CalculateHappinessIndex: This procedure will display the Happiness index


of the property. The calculation is based on ratings of the variables like
Cultural_and_Recreational_Opportunities, Transportation_and_Mobility,
Education_and_Skill_Development, Environmental_Quality and
Access_to_Services_and_Amenities. All of the above variables are rated out
of 5 for every property. The procedure will take Property_id as the input and
will calculate the Happiness index of that particular property as per the
formula:
Happiness_index = (sum of all variables)/5

The index will be on a grading scale of 5. Happiness index score will reflect how
good the property is.
3. GetAvailableBalance: This procedure will calculate and display the
available balance of any user. It will take User_id as the input parameter and
calculate the balance of that user.

4. Calculate_Commision: This procedure will calculate the total commission


of any agent. It will take agent_id as the input parameter and will calculate
the total commission the agent has earned by adding all the commissions the
agent got in property renting/selling.

5. GetPropertyStatus: This procedure will display the status of any property.


It will take Property_id and will display whether the property is “Rented”,
“Sold” or “Free”.
Entity - Relationship Diagram

Link:
https://miro.com/app/board/uXjVKZcor68=/?share_link_id=516751607347
Table Design (Data Dictionary)
MySQL Queries of table creation

1. Properties table
2. Property_type
3. Images
4. Happiness_index
5. Property_Rental
6. Property_Sale
7. Agent
8. Agent_Properties
9. User
10.User_type
11.Ratings
12.Commissions
13.Master_transactions
14.Transaction_log
15.Appointment
Code to connect front-end and back-end
Stored Functions and Procedures codes

1. Calculate_Rent

Code:
Calling block:
2. GetPropertyDetails
Calling block:
3. AddMoney

Code:
Calling block:
4. DeductMoney

Code:
Calling block:
5. GetAverageRating

Code:
Calling block:
Stored Procedures Codes

1. GetUserTransactions

Code:
Calling block:
2. CalculateHappinessIndex

Code:
Calling block:
3. GetAvailableBalance

Code:
Calling block:
4. Calculate_Commision

Code:
Calling block:
5. GetPropertyStatus

Code:
Calling block:
Triggers

1. Check Deposit: For any property on Rent, its deposit amount must be greater
than 10,000. Otherwise trigger will not allow the new record to be inserted
and hence property cannot be rented.

Code:

DELIMITER //

CREATE TRIGGER check_deposit_trigger BEFORE INSERT ON


Property_Rental
FOR EACH ROW
BEGIN
IF NEW.DEPOSIT <= 10000 THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Deposit amount must be more than
$10,000';
END IF;
END//

DELIMITER ;
2. Update balance: If any transaction occurs then the balance of users gets
changed. Balance of payer will decrease will that of payee will increase.
This trigger will automatically update the balance of both the users once the
transaction is completed.

Code:

DELIMITER //

CREATE TRIGGER update_balance_trigger


AFTER INSERT ON Master_transactions
FOR EACH ROW
BEGIN
DECLARE payer_balance DECIMAL(10, 2);
DECLARE payee_balance DECIMAL(10, 2);

-- Get the current balances of payer and payee


SELECT balance INTO payer_balance FROM user_types WHERE
user_id = NEW.Payer;
SELECT balance INTO payee_balance FROM user_types WHERE
user_id = NEW.Payee;

-- Update balances based on transaction status


IF NEW.Status = 'completed' THEN
UPDATE user_types SET balance = payer_balance - NEW.Amount
WHERE user_id = NEW.Payer;
UPDATE user_types SET balance = payee_balance + NEW.Amount
WHERE user_id = NEW.Payee;
END IF;
END//

DELIMITER ;
3. Update average rating: If a new rating is given then the average rating will
be updated automatically.

Code:

DELIMITER //

CREATE TRIGGER update_average_rating


AFTER INSERT ON Ratings
FOR EACH ROW
BEGIN
DECLARE avg_rating DECIMAL(5, 2);

-- Calculate the average rating for the user


SELECT AVG(Rating) INTO avg_rating
FROM Ratings
WHERE User_id = NEW.User_id;

-- Update the average rating in the Users table


UPDATE users
SET RATING = avg_rating
WHERE users.USER_ID = NEW.User_id;
END//

DELIMITER ;
4. Check password: If a new user registers himself and his password length is
less than 10 then it will display an error message.

Code:

DELIMITER //

CREATE TRIGGER before_insert_update_password


BEFORE INSERT ON users
FOR EACH ROW
BEGIN
IF CHAR_LENGTH(NEW.PASSWORD) < 10 THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Password must be at least 8 characters long';
END IF;
END//

DELIMITER ;
5. Positive Happiness index: This trigger will check that none of the variables
used in calculating happiness index are negative.

Code:

DELIMITER //

CREATE TRIGGER happiness_index_positive_values_trigger


BEFORE INSERT ON Happiness_INDEX
FOR EACH ROW
BEGIN
IF NEW.Cultural_and_Recreational_Opportunities <= 0 OR
NEW.Transportation_and_Mobility <= 0 OR
NEW.Education_and_Skill_Development <= 0 OR
NEW.Environmental_Quality <= 0 OR
NEW.Access_to_Services_and_Amenities <= 0 OR
NEW.Happiness_Index <= 0 THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Values must be positive and non-zero';
END IF;
END//

DELIMITER ;
Screenshots of result generated after functions and procedures are
called on the front-end

Calculate Rent output:

Get Property Details output:


Add money output:
Deduct money output:
Average rating output:
Get user transactions output:

Calculate Happiness index output:


Available balance output:

Get commission output:


Get property status output:
Screenshots of errors generated on the front-end when trigger is
fired

Trigger-1
If deposit for any rented property is less than 10000 then the following trigger will
be fired:

Note for Trigger 2 and 3:

● In Trigger 2 and 3 no error will be generated, because in both of them if


records are inserted in one table then the record in another table will be
updated automatically.
● In Trigger 2 if any transaction completes successfully then the balance of the
payer and payee will be updated in the User_types table.
● In Trigger 3 if a new rating is given to any user then his/her average rating
would be updated in the users table.
Trigger-4
If a new user signs up and he/she creates a password of length less than 10
characters then the following trigger will be fired:

Trigger-5
If any variable involved in calculation of happiness index then the following
trigger will be fired:
Screenshots of our website

1. About Us Page

Once, anybody opens our website he/she will see the About Us page which tells
the user about our company. It gives brief information about the functioning of our
website. Users will also get to see 4 options namely Home, Properties, Services
and Contact Us on the top right corner. He/She can scroll to any of the pages from
here based on their needs.
2. Home Page

This is our home page. You can navigate to this page by clicking on the Home
Page option on the About Us page. The home page gives any new user the
information about what type of services we offer at our website
On scrolling down the page you will get to see the list of areas like SG highway,
Science city, Sindhu bhavan where we have either sold or rented any property. You
will also see some images of the properties which are out for rent or sale.
On scrolling further you will be able to see the steps of how we select any property.
Many properties are listed on our website for rent or sale. We follow a procedure
and have certain conditions. Properties which fulfill those conditions are then
approved and rest are removed.
This is the end of our home page which lists the benefits of our website like we are
operational in Prime locations of Ahmedabad and Gandhinagar, We offer modern
properties with excellent service. It also displays some stats like how many clients
we have served till now and how many property deals we have done.
3. Login / Sign up Page

This is the page where a new user will sign up by entering some details like full
name, email address and by creating a password. The existing users will have to
enter their created email and password for Login.
4. List Your Property

This page is for the sellers and renters who want to sell/rent their property. To list
their property on our website they will have to upload some details like about the
property, images of the property, documents etc.

5. Add Money
6. Services

7. Transactions Page
8. Contact Us
9. User Dashboard

10. Agent Dashboard


11.Get Available Balance

12. Property Rental Form


13. Calculate Commission

14. Deduct Money


15. Happiness Index

16. Average Rating


17. Owner Dashboard

18. Seller
19. User Transaction

20. Calculate Rent

You might also like