https://github.com/siddhant4srivastava/sql-project
SQL-based project analyzing tenant profiles, rental data, and referral activities to answer key business queries.
https://github.com/siddhant4srivastava/sql-project
database-management sql
Last synced: 5 months ago
JSON representation
SQL-based project analyzing tenant profiles, rental data, and referral activities to answer key business queries.
- Host: GitHub
- URL: https://github.com/siddhant4srivastava/sql-project
- Owner: siddhant4srivastava
- Created: 2025-01-10T15:21:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-10T15:27:15.000Z (over 1 year ago)
- Last Synced: 2025-08-07T16:34:08.961Z (11 months ago)
- Topics: database-management, sql
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Tenant Management System Analysis
## Project Overview
This project focuses on analyzing tenant data to address critical business queries using SQL. The dataset contains tenant profiles, rental history, referral activities, and property details. The goal is to derive actionable insights that support decision-making, optimize operations, and improve resource utilization.
## Objectives
The project answers the following key questions:
1. Identify the tenant with the longest stay duration in the past.
2. Retrieve details of married tenants paying rent greater than ₹9000 using subqueries.
3. List detailed information about tenants living in Bangalore or Pune during 2015–2016, sorted by rent.
4. Analyze referral activities to find tenants with multiple valid referrals and calculate their bonus amounts.
5. Compute the rent revenue generated by each city and the total across all cities.
6. Create a view to display vacant beds and tenant details for houses occupied after April 30, 2015.
7. Extend the validity date of tenants with more than two referrals by one month.
8. Categorize tenants into segments (Grade A, B, or C) based on their rent payments.
9. Find details of tenants who have not referred anyone.
10. Identify the house with the highest occupancy and retrieve its details.
## Methodology
### Data Processing
- The dataset was structured into multiple tables, including tenant profiles, rental history, referrals, and house details.
- SQL queries utilized filtering, joins, subqueries, and aggregation to extract insights and generate outputs.
### Key SQL Features Used
- **Aggregation:** Functions like `SUM`, `COUNT`, and `MAX` to compute revenues and identify trends.
- **Subqueries and Joins:** Nested queries and joins across multiple tables to gather and combine related data.
- **Conditional Logic:** `CASE` statements for tenant segmentation and `WHERE` clauses for targeted filtering.
- **Views:** Created a reusable view for managing house vacancies and tenant data dynamically.
- **Date Functions:** Applied date manipulation techniques to calculate stay durations and update validity periods.
### Tools
- **Database Management System:** MySQL server.
## Outputs
The project delivers:
1. A set of SQL scripts addressing all the business queries.
2. A dynamic view for managing tenant data and house vacancies.
3. Outputs for each query, provided as reports or tables for business use.
## Challenges and Solutions
- **NULL Handling:** Addressed missing data for ongoing stays and rents using conditional logic (`COALESCE`).
- **Performance Optimization:** Optimized queries with indexing, efficient joins, and limiting unnecessary computations.
- **Business Logic Complexity:** Ensured query logic aligned with business definitions, such as valid referrals and customer segmentation.
- ## Acknowledgments
I am grateful to Edvancer Eduventures for providing guidance and resources throughout these projects, which helped deepen my understanding of SQL and relational database concepts.