This project analyzes a bookstore sales database using PostgreSQL to uncover valuable business insights related to book sales, customer purchasing behavior, inventory management, and revenue generation.
The analysis focuses on books, customers, and orders to identify top-selling books, customer spending patterns, genre-wise sales, inventory status, and overall business performance.
This project demonstrates practical SQL skills including joins, aggregation, filtering, grouping, sorting, subqueries, and business-oriented data analysis.
- PostgreSQL
- SQL
- CSV Dataset
- Data Analysis
- GitHub
The project consists of three relational tables:
- Book ID
- Title
- Author
- Genre
- Published Year
- Price
- Stock
- Customer ID
- Name
- Phone
- City
- Country
- Order ID
- Customer ID
- Book ID
- Order Date
- Quantity
- Total Amount
These tables are connected using primary and foreign keys to perform relational SQL analysis.
- Retrieved all books in the Fiction genre.
- Listed books published after 1950.
- Retrieved customers from Canada.
- Displayed orders placed during November 2023.
- Calculated total available book stock.
- Identified the most expensive book.
- Retrieved orders with quantity greater than one.
- Found orders with total amount greater than $20.
- Listed all available book genres.
- Found the book with the lowest stock.
- Calculated total revenue generated from all orders.
- Calculated total books sold for each genre.
- Computed average price of Fantasy books.
- Identified customers who placed multiple orders.
- Found the most frequently ordered book.
- Retrieved the top three most expensive Fantasy books.
- Calculated total books sold by each author.
- Listed cities of customers spending more than $30.
- Identified the customer with the highest total spending.
- Calculated remaining stock after fulfilling all customer orders.
| Insight | Description |
|---|---|
| Revenue Analysis | Calculated total revenue generated from all customer orders. |
| Best Selling Books | Identified the books ordered most frequently. |
| Customer Spending | Found the customers contributing the highest revenue. |
| Genre Performance | Compared total books sold across different genres. |
| Inventory Management | Calculated remaining stock after sales. |
| Premium Books | Identified the highest-priced books in the inventory. |
| Customer Activity | Analyzed customers placing multiple orders. |
| Sales Distribution | Examined city-wise customer purchasing activity. |
✦ Fiction and Fantasy books contribute significantly to overall sales.
✦ A small group of repeat customers generates a large portion of total revenue.
✦ Some books have very low remaining inventory, indicating the need for restocking.
✦ Genre-wise analysis helps identify customer preferences and popular categories.
✦ Revenue analysis highlights high-value transactions and purchasing trends.
- Practice SQL using a real-world relational database.
- Analyze bookstore sales and customer behavior.
- Perform joins across multiple tables.
- Generate business insights using SQL queries.
- Strengthen PostgreSQL querying skills.
This project demonstrates how SQL can be used to analyze a relational bookstore database and generate meaningful business insights.
By exploring customer purchases, book inventory, genre performance, and revenue trends, the analysis showcases practical SQL techniques commonly used in real-world data analytics projects.
The project strengthens SQL fundamentals while demonstrating the ability to solve business problems using structured query language.
If you found this project useful or would like to collaborate, feel free to connect!