Inventory & Margin Optimization
> Engineering SQL queries to bridge the gap between menu complexity and operational profitability.
Top Revenue
Italian
Cuisine Performance
Peak Volume
Lunch
Mon/Fri/Sun Demand
Star Item
Korean Beef Bowl
High Profit / High Vol
Fusion Factor
49% Drop-off
Conversion Opportunity
Query Showcase
01. Temporal Traffic Analysis
Identifying the bottleneck hours using cron-style SQL ordering.
SELECT
DAYNAME(order_date) AS day_of_week,
HOUR(order_time) AS hour_of_day,
COUNT(DISTINCT order_id) AS number_of_orders
FROM fact_orders
GROUP BY
DAYOFWEEK(order_date), day_of_week, hour_of_day
ORDER BY
DAYOFWEEK(order_date), number_of_orders DESC;
Result: Lunch hours on Mon/Fri/Sun are critical peaks. Recommended staffing increase specifically for these windows to maintain service SLAs.
02. Strategic Menu Matrix (CTE + NTILE)
Classification of menu items into 'Stars', 'Puzzle', 'Workhorse', and 'Dud'.
WITH total_order_revenue AS (
SELECT
m.item_name,
COUNT(o.order_id) AS total_orders,
SUM(m.price) AS total_revenue
FROM dim_menu_items m
INNER JOIN fact_orders o ON m.menu_item_id = o.item_id
GROUP BY m.item_name
),
ItemRanks AS (
SELECT
item_name, total_orders, total_revenue,
NTILE(2) OVER (ORDER BY total_orders DESC) AS order_ntile,
NTILE(2) OVER (ORDER BY total_revenue DESC) AS revenue_ntile
FROM total_order_revenue
)
SELECT
item_name, total_orders, total_revenue,
CASE
WHEN order_ntile = 1 AND revenue_ntile = 1 THEN 'Star'
WHEN order_ntile = 1 AND revenue_ntile = 2 THEN 'Workhorse'
WHEN order_ntile = 2 AND revenue_ntile = 1 THEN 'Puzzle'
WHEN order_ntile = 2 AND revenue_ntile = 2 THEN 'Dud'
END AS item_category
FROM ItemRanks;
Result: Isolated 'Stars' vs 'Duds'. Revealed that the Hamburger (Volume Leader) isn't the primary Revenue Driver, prompting a re-valuation of bundling strategies.
Building the Data Pipeline
Schema Foundation
Constructed a robust dimensional model (Star Schema). Joined operational fact tables with menu dimension items to create a reliable playground for complex analytical queries.
Basket Analysis (Self-Joins)
Executed self-joins on the `fact_orders` table to uncover cross-cuisine purchasing behavior. Found that customers frequently pair American staples with Asian sides.
Operational Logic
Engineered CASE expressions to drive automated categorization. This removed manual guesswork for the management team, providing a live "Menu Dashboard" via SQL views.
Strategic Roadmap
- • Promote the Italian category as the primary revenue "Puzzle" segment.
- • Launch "Fusion Combos" based on identified basket pairing trends.
Revenue Gains
- • Focus on "Star" items (Korean Beef Bowl) to maximize high-margin sales.
- • Staffing optimization for peak lunchtime windows (Mon, Fri, Sun).
Technical Toolkit
Analyst Insight
"Data revealed that customers are more adventurous than the menu suggests. Pairing patterns prove that 'Fusion' isn't just a trend—it's how the customer base actually eats."
Github Repository