๐ SQL Project Series #24Real Estate Property Analytics ๐
Analyze properties, buyers, agents, sales, and rentals using SQL to understand market trends, optimize pricing, and improve business performance.
๐ฏ Business Objectivesโ
Analyze property sales
โ
Monitor rental performance
โ
Evaluate agent performance
โ
Track customer preferences
โ
Analyze property prices
โ
Measure market trends
โ
Identify high-demand locations
โ
Build executive dashboards
๐ Step 1: Create Database CREATE DATABASE real_estate_db;
USE real_estate_db;
๐ Step 2: Create Agents Table CREATE TABLE agents (
agent_id INT PRIMARY KEY,
agent_name VARCHAR(100),
city VARCHAR(50),
experience_years INT
);
๐ Step 3: Create Customers Table CREATE TABLE customers (
customer_id INT PRIMARY KEY,
customer_name VARCHAR(100),
city VARCHAR(50),
customer_type VARCHAR(20)
);
๐ Step 4: Create Properties Table CREATE TABLE properties (
property_id INT PRIMARY KEY,
property_type VARCHAR(50),
city VARCHAR(50),
bedrooms INT,
listing_price DECIMAL(12,2),
listing_date DATE,
agent_id INT,
FOREIGN KEY (agent_id)
REFERENCES agents(agent_id)
);
๐ Step 5: Create Transactions Table CREATE TABLE transactions (
transaction_id INT PRIMARY KEY,
property_id INT,
customer_id INT,
transaction_type VARCHAR(20),
transaction_date DATE,
sale_price DECIMAL(12,2),
FOREIGN KEY (property_id)
REFERENCES properties(property_id),
FOREIGN KEY (customer_id)
REFERENCES customers(customer_id)
);
๐ Step 6: Insert Sample Agents INSERT INTO agents VALUES
(101,'Amit Sharma','Mumbai',8),
(102,'Priya Singh','Delhi',6),
(103,'Rahul Mehta','Pune',10),
(104,'Sneha Patel','Bangalore',5);
๐ Step 7: Insert Sample Customers INSERT INTO customers VALUES
(1,'Rahul Verma','Mumbai','Buyer'),
(2,'Anjali Gupta','Delhi','Tenant'),
(3,'Rohan Patel','Pune','Buyer'),
(4,'Neha Sharma','Bangalore','Tenant'),
(5,'Aakash Shah','Hyderabad','Buyer');
๐ Step 8: Insert Sample Properties INSERT INTO properties VALUES
(1001,'Apartment','Mumbai',2,8500000,'2025-01-05',101),
(1002,'Villa','Delhi',4,22000000,'2025-01-08',102),
(1003,'Apartment','Pune',3,9500000,'2025-01-12',103),
(1004,'Studio','Bangalore',1,4200000,'2025-01-15',104),
(1005,'Villa','Hyderabad',5,28000000,'2025-01-18',103);
๐ Step 9: Insert Sample Transactions INSERT INTO transactions VALUES
(5001,1001,1,'Sale','2025-02-01',8300000),
(5002,1002,2,'Rent','2025-02-03',45000),
(5003,1003,3,'Sale','2025-02-05',9200000),
(5004,1004,4,'Rent','2025-02-08',28000),
(5005,1005,5,'Sale','2025-02-12',27500000);
๐ง SQL Concepts You'll Practiceโ DDL & DML
โ INNER JOIN
โ LEFT JOIN
โ Aggregate Functions
โ GROUP BY
โ HAVING
โ CASE WHEN
โ Date Functions
โ CTEs
โ Window Functions
โ Ranking Functions
๐ Business KPIs You Can Build๐ Total Properties Listed
๐ Total Properties Sold
๐ Total Rental Properties
๐ Total Sales Revenue
๐ Average Property Price
๐ Average Rent
๐ Revenue by City
๐ Revenue by Property Type
๐ Top Performing Agents
๐ Agent-wise Sales
๐ Average Selling Time
๐ Property Listing Trend
๐ Monthly Sales Trend
๐ Most Expensive Property Sold
๐ Cheapest Property Sold
๐ Property Demand by City
๐ Buyer vs Tenant Ratio
๐ Average Bedrooms Sold
๐ Conversion Rate (Listed to Sold)
๐ Executive Real Estate Dashboard
๐ฏ This project reflects real-world SQL analysis performed by Real Estate Analysts, Property Management teams, Sales Analysts, and Business Intelligence professionals to optimize pricing, monitor sales performance, and identify market trends.
Double Tap โค๏ธ For More