This project analyzes restaurant order data using SQL to uncover insights about customer ordering behavior, menu performance, and revenue trends.
The objective of this analysis is to answer key business questions that can help a restaurant improve decision-making around:
The analysis is performed using SQL queries on two relational tables: menu_items and order_details.
This table contains details about the restaurant’s menu items.
| Column | Description |
|---|---|
| menu_item_id | Unique identifier for each menu item |
| item_name | Name of the menu item |
| category | Cuisine or food category |
| price | Price of the item |
This table contains transaction-level information about customer orders.
| Column | Description |
|---|---|
| order_details_id | Unique ID for each record |
| order_id | Unique identifier for each order |
| order_time | Time the order was placed |
| item_id | ID linking the order to a menu item |
SELECT m.item_name,
COUNT(o.order_details_id) AS ordercount,
m.category
FROM menu_items m, order_details o
GROUP BY m.item_name, m.category
ORDER BY ordercount DESC;
This query counts how many times each menu item appears in customer orders.
SELECT m.item_name,
m.category,
SUM(m.price) AS sales,
o.order_id
FROM menu_items m, order_details o
GROUP BY m.item_name, m.category, o.order_id
ORDER BY sales DESC
LIMIT 10;
This query calculates the total value of items purchased within each order.
SELECT COUNT(o.order_details_id) AS ordercount,
EXTRACT(HOUR FROM o.order_time) AS time
FROM order_details o
GROUP BY time
ORDER BY ordercount DESC;
This query extracts the hour from each order time and counts the number of orders placed during each hour.
SELECT m.item_name,
m.category,
SUM(m.price) AS sales,
COUNT(o.order_details_id) AS ordercount
FROM menu_items m, order_details o
GROUP BY item_name, category, order_id
ORDER BY sales DESC;
This query measures both total revenue generated and order frequency for menu items.
SELECT EXTRACT(HOUR FROM order_time) AS time,
SUM(m.price) AS sales
FROM order_details o, menu_items m
GROUP BY time
ORDER BY sales DESC;
This query calculates the total revenue generated during each hour of the day.
This project demonstrates several SQL concepts including:
git clone https://safiyah-abiala.github.io/Restaurant-orders-data-analysis-using-SQL/
Import the dataset into your SQL environment (PostgreSQL, MySQL, or any SQL client).
Run the SQL queries provided in the project to reproduce the analysis.
Through SQL analysis of restaurant order data, this project demonstrates how raw transactional data can be transformed into actionable insights that support:
Ms_Safiyah