This repository contains a database design and SQL query assignment for a Vehicle Rental System. The goal of this assignment is to demonstrate a solid understanding of:
- Relational database structure and schema design
- Entity Relationship Diagrams (ERD)
- Advanced SQL querying with joins, exists conditions, grouping, and filters
You will also explore real-world constraints such as availability of vehicles and relational linkages between users, bookings, and vehicles. :contentReference[oaicite:1]{index=1}
This project includes the following components:
πΉ ERD (Entity Relationship Diagram)
A conceptual diagram that connects the main entities of the system:
| Table | Primary Role |
|---|---|
| Users | Stores customers and admin info |
| Vehicles | Manages vehicle inventory |
| Bookings | Tracks rental agreements |
The relationships are represented as:
- One-to-Many: Users β Bookings
- Many-to-One: Bookings β Vehicles
(NB: Logical One-to-One between a booking, its user, and vehicle) :contentReference[oaicite:2]{index=2}
- INNER JOIN β Get booking info with user + vehicle details
- NOT EXISTS β Find vehicles that were never booked
- WHERE clause β List all available vehicles of a specific type
- GROUP BY + HAVING β Vehicles having more than 2 bookings :contentReference[oaicite:3]{index=3}
π These queries are also provided in queries.sql inside this repository.