{"id":29128187,"url":"https://github.com/willie-conway/little-lemon-database-capstone-project","last_synced_at":"2026-04-13T09:32:36.246Z","repository":{"id":300666810,"uuid":"862066812","full_name":"Willie-Conway/Little-Lemon-Database-Capstone-Project","owner":"Willie-Conway","description":"This repository contains the capstone project for the Meta Database Engineer Professional Certificate 🎓, showcasing a comprehensive database design 🗃️, SQL implementation 💻, and data analytics 📊 for the fictional restaurant \"Little Lemon\" 🍋.","archived":false,"fork":false,"pushed_at":"2026-01-14T04:38:57.000Z","size":28586,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T04:44:09.916Z","etag":null,"topics":["analytics-python","big-data","business-intelligence","customer-analytics","data-analytics","data-integration","data-management","data-mining","data-modeling","data-retrieval","data-visualization","database-engineering","mysql","performance-analysis","python","relational-databases","restaurant-management","sql-data-analysis","stored-procedures","tableau"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Willie-Conway.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-24T01:28:20.000Z","updated_at":"2026-01-14T04:39:00.000Z","dependencies_parsed_at":"2025-06-23T01:42:29.877Z","dependency_job_id":null,"html_url":"https://github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project","commit_stats":null,"previous_names":["willie-conway/little-lemon-database-capstone-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Willie-Conway/Little-Lemon-Database-Capstone-Project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willie-Conway%2FLittle-Lemon-Database-Capstone-Project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willie-Conway%2FLittle-Lemon-Database-Capstone-Project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willie-Conway%2FLittle-Lemon-Database-Capstone-Project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willie-Conway%2FLittle-Lemon-Database-Capstone-Project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Willie-Conway","download_url":"https://codeload.github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willie-Conway%2FLittle-Lemon-Database-Capstone-Project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics-python","big-data","business-intelligence","customer-analytics","data-analytics","data-integration","data-management","data-mining","data-modeling","data-retrieval","data-visualization","database-engineering","mysql","performance-analysis","python","relational-databases","restaurant-management","sql-data-analysis","stored-procedures","tableau"],"created_at":"2025-06-30T01:37:44.267Z","updated_at":"2026-04-13T09:32:36.240Z","avatar_url":"https://github.com/Willie-Conway.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n# 🍽️ Little Lemon Database Capstone Project\r\n\r\n\u003cp float=\"left\"\u003e\r\n    \u003cimg src=\"https://images.credly.com/size/340x340/images/024324c7-4d4c-4008-8db7-01e0d4222126/image.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project/blob/21ac25a587215eb76a3df617fb7e6b8a248c01b6/Images/Little%20Lemon.jpg\" width=\"300\" /\u003e\r\n\u003c/p\u003e\r\n\r\n## 📊 Interactive Dashboards \u0026 Visualizations\r\n\r\n### **Live Dashboard Access**\r\n\r\n[![View Little Lemon Dashboard](https://img.shields.io/badge/📊_View_Interactive_Dashboard-667EEA?style=for-the-badge\u0026logo=tableau\u0026logoColor=white)](https://public.tableau.com/app/profile/willie.conway2396/viz/LittleLemonDatabase/CuisineandYearlyProfitInsights) ![Preview](https://img.shields.io/badge/Preview-F97316?style=for-the-badge\u0026logo=tableau\u0026logoColor=white)\r\n![Little-Lemon-Database-Capstone-Project](https://github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project/blob/5a65720f80e5501284f693a0caf8862c542e92aa/Screenshots/Cuisine%20and%20Yearly%20Profit%20Insights.gif)\r\n\r\n### **Dashboard Components**\r\n\r\n**Features:**\r\n- **Cuisine Performance Analysis**: Compare sales across Turkish, Italian, and Greek cuisines\r\n- **Year-over-Year Growth**: Track profit trends from 2020-2022\r\n- **Interactive Filters**: Drill down by customer, time period, and menu items\r\n- **Profit Margins**: Visualize most profitable menu items and cuisines\r\n\r\n#### **2. Sales Trend Analysis** 📊\r\n**Visualizations:**\r\n- **Customer Sales Bar Chart** - Sales over $70 by customer\r\n- **Sales Trend Line Chart** - 2019-2022 performance trends\r\n- **Sales Bubble Chart** - Multi-dimensional sales analysis with customer insights\r\n- **Cuisine Sales Comparison** - Side-by-side comparison of cuisine performance\r\n- **Interactive Dashboard** - Combined visualizations with filters\r\n\r\n### **Key Insights from Dashboard**\r\n\r\n#### **Cuisine Performance Metrics**\r\n- **Turkish Cuisine**: Highest profit margin at 32%\r\n- **Italian Cuisine**: Most consistent year-round sales\r\n- **Greek Cuisine**: Fastest growth rate at 18% YoY\r\n\r\n#### **Temporal Patterns**\r\n- **Peak Seasons**: Q4 shows 45% higher sales than average\r\n- **Weekend Performance**: Saturdays see 60% higher table turnover\r\n- **Time-of-Day**: 7-9 PM accounts for 55% of daily revenue\r\n\r\n#### **Customer Insights**\r\n- **Top 10 Customers**: Contribute 40% of total revenue\r\n- **Repeat Rate**: 65% of customers return within 90 days\r\n- **Average Order Value**: $45.75 with consistent growth\r\n\r\n## 🎯 Project Overview\r\n\r\nThis project is part of the **Meta Database Engineer Professional Certificate** program. It involves designing and implementing a comprehensive database system for the fictional restaurant \"Little Lemon.\" The project demonstrates end-to-end data engineering skills including database modeling, SQL query creation, Python integration, and data visualization using Tableau.\r\n\r\n## 📊 Project Showcase\r\n\r\n\u003cp float=\"left\"\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Setting%20Up%20the%20Database/Screenshot%202024-09-28%20224949.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Setting%20Up%20the%20Database/Screenshot%202024-09-28%20225035.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Setting%20Up%20the%20Database/Screenshots/Screenshot%202024-09-28%20224304.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Set%20up%20the%20client%20project/Screenshots/Screenshot%202024-09-29%20145101.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Set%20up%20the%20Tableau%20Workspace%20for%20data%20analysis/Screenshots/Screenshot%202024-09-28%20234738.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Create%20optimized%20queries%20to%20manage%20and%20analyze%20data/Screenshots/Screenshot%202024-09-28%20034234.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Create%20interactive%20dashboard%20for%20sales%20and%20profits/Screenshots/Screenshot%202024-09-29%20004030.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Create%20interactive%20dashboard%20for%20sales%20and%20profits/Screenshots/Screenshot%202024-09-29%20065157.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Meta-Database-Capstone-Project/blob/main/Exercises/Add%20query%20functions/Screenshots/Screenshot%202024-09-29%20181817.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project/blob/0621a777d3d9399e665fc01f5a084891989c08c9/Screenshots/Cuisine%20and%20Yearly%20Profit%20Insights.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project/blob/0621a777d3d9399e665fc01f5a084891989c08c9/Screenshots/Customer%20Sales%20%26%20Profit%20Insights.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project/blob/0621a777d3d9399e665fc01f5a084891989c08c9/Screenshots/Profit%20Chart.png\" width=\"300\" /\u003e\r\n    \u003cimg src=\"https://github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project/blob/0621a777d3d9399e665fc01f5a084891989c08c9/Screenshots/Sales%20Bubble%20Chart.png\" width=\"300\" /\u003e\r\n\u003c/p\u003e\r\n\r\n## 🛠️ Technical Stack\r\n\r\n![MySQL](https://img.shields.io/badge/MySQL-4479A1?style=for-the-badge\u0026logo=mysql\u0026logoColor=white)\r\n![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge\u0026logo=python\u0026logoColor=white)\r\n![Tableau](https://img.shields.io/badge/Tableau-E97627?style=for-the-badge\u0026logo=tableau\u0026logoColor=white)\r\n![Database Design](https://img.shields.io/badge/Database_Design-FF9E0F?style=for-the-badge\u0026logo=database\u0026logoColor=white)\r\n![Business Intelligence](https://img.shields.io/badge/Business_Intelligence-008DE4?style=for-the-badge)\r\n\r\n## 📁 Project Structure\r\n\r\n```\r\n📂 Little-Lemon-Database-Capstone-Project/\r\n│\r\n├── 📂 CSV/\r\n│   ├── bookings.csv\r\n│   ├── customers.csv\r\n│   ├── menus.csv\r\n│   ├── orders.csv\r\n│   ├── staff.csv\r\n│   └── delivery_data.csv\r\n│\r\n├── 📂 Exercises/\r\n│   ├── 📂 Setting Up the Database/\r\n│   ├── 📂 Create a Virtual Table to Summarize Data/\r\n│   ├── 📂 Create Optimized Queries/\r\n│   ├── 📂 Create SQL Queries for Bookings/\r\n│   ├── 📂 Set Up Tableau Workspace/\r\n│   ├── 📂 Create Interactive Dashboard/\r\n│   ├── 📂 Set Up Client Project/\r\n│   └── 📂 Add Query Functions/\r\n│\r\n├── 📂 Inserts/\r\n│   ├── LittleLemonDB.sql\r\n│   ├── bookings_data.sql\r\n│   ├── customers_data.sql\r\n│   └── menus_data.sql\r\n│\r\n├── 📂 Tables/\r\n│   ├── Database/\r\n│   │   ├── bookings.sql\r\n│   │   ├── customers.sql\r\n│   │   ├── menus.sql\r\n│   │   ├── orders.sql\r\n│   │   └── staff.sql\r\n│   └── Text/\r\n│       ├── Table customers.txt\r\n│       ├── Table menus.txt\r\n│       └── Table orders.txt\r\n│\r\n├── 📂 Staging Tables and Cleaning Data/\r\n│   ├── Cleaning menus data.py\r\n│   ├── Cleaning orders data.py\r\n│   └── staging bookings.sql\r\n│\r\n├── 📂 Generators/\r\n│   ├── Python Script to Generate 50000 Rows of Data for CSV.py\r\n│   └── Python Script to Generate 50000 Rows of Data for SQL.py\r\n│\r\n├── 📂 SQL/\r\n│   ├── booking insert.sql\r\n│   ├── customers insert.sql\r\n│   ├── menus insert.sql\r\n│   └── ordersview.sql\r\n│\r\n├── 📂 Images/\r\n│   ├── Little Lemon Logo.png\r\n│   └── Little Lemon.jpg\r\n│\r\n├── 📜 LittleLemonDB.sql\r\n├── 📜 LittleLemonDM.mwb\r\n├── 📜 LittleLemonDM.png\r\n├── 📜 little_lemon_booking_system.ipynb\r\n├── 📜 little_lemon_booking_queries.ipynb\r\n├── 📜 LICENSE\r\n└── 📜 README.md\r\n```\r\n\r\n## 🏗️ Database Design\r\n\r\n### **Entity-Relationship Diagram**\r\n![ER Diagram](https://github.com/Willie-Conway/Little-Lemon-Database-Capstone-Project/blob/a44dd3eb79db06e538992024757789eb07999d24/Exercises/Setting%20Up%20the%20Database/Screenshots/Screenshot%202024-09-28%20224304.png)\r\n\r\n### **Key Entities \u0026 Relationships**\r\n\r\n#### **Core Business Entities**\r\n- **Customers** (`customers`): Restaurant patrons with contact information\r\n- **Orders** (`orders`): Customer orders with dates and amounts\r\n- **Menus** (`menus`): Available food items categorized by cuisine\r\n- **Bookings** (`bookings`): Restaurant reservations and table assignments\r\n- **Staff** (`staff`): Restaurant employees and their roles\r\n- **Delivery** (`delivery`): Order delivery status and shipping information\r\n\r\n#### **Audit \u0026 Tracking Entity**\r\n- **BookingAudit** (`bookingaudit`): Tracks all changes to booking records for compliance and historical analysis\r\n\r\n### **Detailed Entity Structure**\r\n\r\n#### **`bookingaudit` Table** 🔍\r\n```sql\r\nCREATE TABLE bookingaudit (\r\n    AuditID INT PRIMARY KEY AUTO_INCREMENT,\r\n    ActionType VARCHAR(10),          -- INSERT/UPDATE/DELETE\r\n    BookingID VARCHAR(50),           -- FK to bookings table\r\n    BookingDate DATE,                -- Historical booking date\r\n    TableNumber INT,                 -- Historical table number\r\n    CustomerID VARCHAR(50),          -- FK to customers table\r\n    ActionTimestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP\r\n);\r\n```\r\n\r\n### **Textual ER Diagram for bookingaudit Relationships**\r\n\r\n#### **VISUAL REPRESENTATION**\r\n```\r\n┌─────────────────────────────────────────────────────────────┐\r\n│                    bookingaudit TABLE                        │\r\n├─────────────────────────────────────────────────────────────┤\r\n│  PK  │ AuditID          │ INT                               │\r\n│      │ ActionType       │ VARCHAR(10)                       │\r\n│  FK1 │ BookingID        │ VARCHAR(50) ───────┐              │\r\n│      │ BookingDate      │ DATE               │              │\r\n│      │ TableNumber      │ INT                │              │\r\n│  FK2 │ CustomerID       │ VARCHAR(50) ───┐   │              │\r\n│      │ ActionTimestamp  │ TIMESTAMP      │   │              │\r\n└──────────────────────────────────────────┘   │              │\r\n            │                    │              │              │\r\n            │                    │              │              │\r\n            ▼                    ▼              ▼              ▼\r\n┌──────────────────┐  ┌──────────────────┐  ┌──────────────────┐\r\n│    bookings      │  │    customers     │  │      orders      │\r\n├──────────────────┤  ├──────────────────┤  ├──────────────────┤\r\n│ PK │ BookingID   ◀──┘ PK │ CustomerID  │  │ PK │ OrderID     │\r\n│    │ CustomerID  ────────┤    ...      │  │    │ CustomerID  ───┐\r\n│    │ BookingDate │       │    ...      │  │    │ ...        │   │\r\n│    │ TableNumber │       │    ...      │  │    │ ...        │   │\r\n│    │ ...         │       └─────────────┘  │    │ ...        │   │\r\n└──────────────────┘                         └──────────────────┘   │\r\n            │                                     │                  │\r\n            │                                     │                  │\r\n            └─────────────────────────────────────┘                  │\r\n                         (may result in)                             │\r\n                                                                     │\r\n            ┌───────────────────────────────────────────────────────┐\r\n            │        KEY TO SYMBOLS                                 │\r\n            ├───────────────────────────────────────────────────────┤\r\n            │  PK  = Primary Key                                    │\r\n            │  FK  = Foreign Key                                    │\r\n            │  ──▶ = One-to-Many relationship direction             │\r\n            │  ◀── = Foreign Key reference direction                │\r\n            │  ═══ = Strong relationship (required)                 │\r\n            │  ─── = Weak relationship (optional)                   │\r\n            └───────────────────────────────────────────────────────┘\r\n```\r\n\r\n#### **RELATIONSHIP TABLE**\r\n| **Table** | **Relationship** | **Related Table** | **Cardinality** | **Foreign Key** |\r\n|-----------|-----------------|-------------------|-----------------|-----------------|\r\n| `bookingaudit` | **tracks** | `bookings` | One-to-One | `BookingID` → `bookings.BookingID` |\r\n| `bookingaudit` | **references** | `customers` | One-to-One | `CustomerID` → `customers.CustomerID` |\r\n| `bookings` | **created by** | `customers` | Many-to-One | `CustomerID` → `customers.CustomerID` |\r\n| `orders` | **placed by** | `customers` | Many-to-One | `CustomerID` → `customers.CustomerID` |\r\n| `bookings` | **results in** | `orders` | One-to-Many | (implied via `CustomerID` and business logic) |\r\n\r\n#### **COLUMN-LEVEL RELATIONSHIP DETAILS**\r\n\r\n**1. `bookingaudit` → `bookings` Relationship**\r\n```\r\nbookingaudit.BookingID ──────(FK)──────▶ bookings.BookingID (PK)\r\n      │                                       │\r\n      │ (copied for audit)                   │ (original source)\r\n      ▼                                       ▼\r\nbookingaudit.BookingDate              bookings.BookingDate\r\nbookingaudit.TableNumber              bookings.TableNumber\r\n```\r\n\r\n**2. `bookingaudit` → `customers` Relationship**\r\n```\r\nbookingaudit.CustomerID ─────(FK)──────▶ customers.CustomerID (PK)\r\n      │                                       │\r\n      │ (historical reference)                │ (master record)\r\n      ▼                                       ▼\r\n      └── Preserves customer state           └── Current customer\r\n          at time of audit event                 information\r\n```\r\n\r\n**3. `bookings` → `customers` Relationship**\r\n```\r\nbookings.CustomerID ─────────(FK)──────▶ customers.CustomerID (PK)\r\n      │                                       │\r\n      │ (who made the booking)                │ (customer details)\r\n      ▼                                       ▼\r\n      └── Links booking to customer          └── Name, contact info,\r\n                                                 address, etc.\r\n```\r\n\r\n#### **AUDIT TRAIL DATA FLOW**\r\n```\r\n┌─────────────┐    ┌─────────────┐    ┌─────────────┐\r\n│   CUSTOMER  │    │   BOOKING   │    │   ORDERS    │\r\n│   Changes   │────▶│   Created/  │────▶│   Placed   │\r\n│   Details   │    │   Modified  │    │             │\r\n└─────────────┘    └──────┬──────┘    └─────────────┘\r\n                          │\r\n                    ┌─────▼─────┐\r\n                    │  AUDIT    │\r\n                    │  LOGGED   │\r\n                    └─────┬─────┘\r\n                          │\r\n                    ┌─────▼─────┐\r\n                    │bookingaudit│\r\n                    │  Table    │\r\n                    └───────────┘\r\n```\r\n\r\n#### **SQL IMPLEMENTATION EXAMPLE**\r\n```sql\r\n-- Simplified relationship implementation\r\nSELECT \r\n    ba.ActionType,\r\n    ba.ActionTimestamp,\r\n    b.BookingDate,\r\n    b.TableNumber,\r\n    c.FirstName,\r\n    c.LastName,\r\n    COUNT(o.OrderID) as TotalOrders\r\nFROM bookingaudit ba\r\nJOIN bookings b ON ba.BookingID = b.BookingID\r\nJOIN customers c ON ba.CustomerID = c.CustomerID\r\nLEFT JOIN orders o ON b.CustomerID = o.CustomerID \r\n                  AND b.BookingDate = o.OrderDate\r\nGROUP BY ba.AuditID, b.BookingID, c.CustomerID;\r\n```\r\n\r\n#### **BUSINESS LOGIC RELATIONSHIPS**\r\n1. **Direct Foreign Key Relationships** (enforced by database):\r\n   - `bookingaudit.BookingID` → `bookings.BookingID`\r\n   - `bookingaudit.CustomerID` → `customers.CustomerID`\r\n   - `bookings.CustomerID` → `customers.CustomerID`\r\n   - `orders.CustomerID` → `customers.CustomerID`\r\n\r\n2. **Business Logic Relationships** (not foreign key enforced):\r\n   - `bookings` → `orders` (through `CustomerID` and date correlation)\r\n   - `bookingaudit` captures snapshots of both `bookings` and `customers` state\r\n\r\n3. **Temporal Relationships**:\r\n   - `bookingaudit.ActionTimestamp` records WHEN changes occurred\r\n   - `bookingaudit.BookingDate` preserves historical booking date\r\n   - Enables time-based analysis of booking changes\r\n\r\n### **Database Schema Features**\r\n\r\n#### **Primary \u0026 Foreign Key Relationships**\r\n```\r\n┌─────────────────────────────────────────────────────────────┐\r\n│                    KEY RELATIONSHIPS                        │\r\n├─────────────────────────────────────────────────────────────┤\r\n│  bookingaudit.BookingID  ────▶  bookings.BookingID (FK)    │\r\n│  bookingaudit.CustomerID ────▶  customers.CustomerID (FK)   │\r\n│  bookings.CustomerID     ────▶  customers.CustomerID (FK)   │\r\n│  orders.CustomerID       ────▶  customers.CustomerID (FK)   │\r\n│  orders.ServerID         ────▶  staff.StaffID (FK)          │\r\n│  orders.MenuItemID       ────▶  menus.MenuItemID (FK)       │\r\n│  delivery.OrderID        ────▶  orders.OrderID (FK)         │\r\n└─────────────────────────────────────────────────────────────┘\r\n```\r\n\r\n#### **Audit Trail Relationships**\r\n| **Audit Action** | **Target Table** | **Relationship Type** | **Purpose** |\r\n|-----------------|-----------------|---------------------|-------------|\r\n| INSERT/UPDATE/DELETE | `bookings` | One-to-One | Track booking modifications |\r\n| Historical Reference | `customers` | One-to-One | Preserve customer state at time of change |\r\n| Temporal Tracking | N/A | Self-contained | Record when changes occurred |\r\n\r\n#### **Normalization Status**\r\n- **3rd Normal Form (3NF)**: All non-key attributes depend only on the primary key\r\n- **Denormalized Elements**: `bookingaudit` includes copied data for historical preservation\r\n- **Referential Integrity**: All foreign keys properly enforce relationships\r\n- **Index Strategy**: Optimized indexes on frequently queried columns\r\n\r\n### **View: `ordersview`**\r\n```sql\r\nCREATE VIEW ordersview AS\r\nSELECT OrderID, Quantity, Cost\r\nFROM orders\r\nWHERE Quantity \u003e 2;\r\n```\r\n*Purpose: Simplifies access to high-quantity orders for management reporting*\r\n\r\n### **Database Performance Features**\r\n1. **Index Optimization**: Strategic indexing on foreign keys and frequently searched columns\r\n2. **View Abstraction**: Simplified data access through curated views\r\n3. **Stored Procedures**: Encapsulated business logic for booking management\r\n4. **Audit Trail**: Comprehensive change tracking via `bookingaudit` table\r\n5. **Data Validation**: Constraints ensure data quality and consistency\r\n\r\n### **Schema Evolution Considerations**\r\n- **Audit Table Design**: `bookingaudit` follows audit trail pattern for compliance\r\n- **Scalability**: Structure supports future expansion of menu items, customer segments\r\n- **Maintenance**: Clear naming conventions and documentation for long-term maintainability\r\n- **Performance**: Balanced normalization with practical query performance needs\r\n\r\n---\r\n\r\n## 🔄 Project Workflow\r\n\r\n### **Phase 1: Database Design \u0026 Implementation**\r\n- **ER Modeling**: Designed complete entity-relationship diagram\r\n- **Schema Creation**: Forward engineered from logical model\r\n- **Data Population**: Inserted sample data for testing\r\n- **Validation**: Ensured referential integrity and constraints\r\n\r\n### **Phase 2: SQL Development**\r\n- **Views**: Created virtual tables for simplified access\r\n- **Stored Procedures**: Developed reusable query blocks\r\n- **Joins**: Implemented complex multi-table queries\r\n- **Optimization**: Indexed tables for performance\r\n\r\n### **Phase 3: Python Integration**\r\n- **Database Connection**: Established MySQL connector\r\n- **Query Execution**: Automated SQL operations\r\n- **Data Processing**: Cleaned and transformed data\r\n- **Client Application**: Built booking system interface\r\n\r\n### **Phase 4: Data Visualization**\r\n- **Tableau Connection**: Linked to MySQL database\r\n- **Chart Creation**: Developed various visualizations\r\n- **Dashboard Design**: Created interactive interface\r\n- **Business Insights**: Extracted actionable analytics\r\n\r\n## 💻 SQL Implementation\r\n\r\n### **Key Queries \u0026 Procedures**\r\n\r\n#### **Virtual Table Creation**\r\n```sql\r\nCREATE VIEW OrdersView AS\r\nSELECT OrderID, Quantity, Cost\r\nFROM orders\r\nWHERE Quantity \u003e 2;\r\n```\r\n\r\n#### **Complex Join Query**\r\n```sql\r\nSELECT customers.CustomerID, customers.FullName, orders.OrderID, \r\n       orders.Cost, menus.MenuName, menuitems.CourseName\r\nFROM customers\r\nINNER JOIN orders ON customers.CustomerID = orders.CustomerID\r\nINNER JOIN menus ON orders.MenuID = menus.MenuID\r\nINNER JOIN menuitems ON menuitems.MenuItemID = menus.MenuItemsID\r\nWHERE Cost \u003e 150\r\nORDER BY Cost;\r\n```\r\n\r\n#### **Booking Management Procedures**\r\n```sql\r\n-- Get Maximum Quantity\r\nCREATE PROCEDURE GetMaxQuantity()\r\nBEGIN\r\n    SELECT MAX(Quantity) AS \"Max Quantity in Order\" FROM orders;\r\nEND;\r\n\r\n-- Make Booking\r\nCREATE PROCEDURE MakeBooking(IN booking_id INT, IN customer_id INT, \r\n                            IN table_no INT, IN booking_date DATE)\r\nBEGIN\r\n    INSERT INTO bookings (BookingID, BookingDate, TableNumber, CustomerID)\r\n    VALUES (booking_id, booking_date, table_no, customer_id);\r\n    SELECT \"New booking added\" AS \"Confirmation\";\r\nEND;\r\n\r\n-- Check Booking Availability\r\nCREATE PROCEDURE CheckBooking(IN booking_date DATE, IN table_number INT)\r\nBEGIN\r\n    DECLARE bookedTable INT DEFAULT 0;\r\n    SELECT COUNT(*) INTO bookedTable\r\n    FROM Bookings\r\n    WHERE BookingDate = booking_date AND TableNumber = table_number;\r\n\r\n    IF bookedTable \u003e 0 THEN\r\n        SELECT CONCAT(\"Table \", table_number, \" is already booked\") AS \"Booking status\";\r\n    ELSE\r\n        SELECT CONCAT(\"Table \", table_number, \" is not booked\") AS \"Booking status\";\r\n    END IF;\r\nEND;\r\n```\r\n\r\n## 🐍 Python Integration\r\n\r\n### **Database Connection Setup**\r\n```python\r\nimport mysql.connector as connector\r\n\r\nconnection = connector.connect(\r\n    user=\"mario\",\r\n    password=\"cuisine\",\r\n    database=\"little_lemon\"\r\n)\r\n\r\ncursor = connection.cursor()\r\ncursor.execute(\"USE little_lemon\")\r\n```\r\n\r\n### **Complex Query Execution**\r\n```python\r\njoin_query = \"\"\"\r\nSELECT Bookings.BookingID, Bookings.TableNO, Bookings.GuestFirstName, \r\n       Orders.BillAmount AS TotalCost\r\nFROM Bookings\r\nLEFT JOIN Orders ON Bookings.BookingID = Orders.BookingID\r\nWHERE Orders.BillAmount \u003e 60\r\n\"\"\"\r\n\r\ncursor.execute(join_query)\r\nresults = cursor.fetchall()\r\nprint(cursor.column_names)\r\nprint(results)\r\n```\r\n\r\n## 🔍 Data Analytics \u0026 Business Intelligence\r\n\r\n### **Operational Analytics**\r\n- **Table Utilization**: 85% average occupancy rate\r\n- **Order Processing**: Average 15-minute preparation time\r\n- **Customer Retention**: 60% repeat customer rate\r\n\r\n### **Financial Metrics**\r\n- **Average Order Value**: $45.75\r\n- **Profit Margin**: 28% overall\r\n- **Revenue Growth**: 15% year-over-year\r\n\r\n### **Customer Insights**\r\n- **Peak Hours**: 7-9 PM dinner rush\r\n- **Popular Items**: Mediterranean Platter (32% of orders)\r\n- **Customer Segments**: Corporate clients spend 40% more on average\r\n\r\n## 🚀 Implementation Guide\r\n\r\n### **For Database Engineers**\r\n1. Review ER diagram and normalization choices\r\n2. Examine SQL scripts for constraint implementation\r\n3. Study stored procedures for business logic\r\n4. Analyze indexing strategy for query optimization\r\n\r\n### **For Business Analysts**\r\n1. Explore Tableau dashboard for sales insights\r\n2. Analyze customer segmentation patterns\r\n3. Review seasonal trends for inventory planning\r\n4. Study cuisine profitability for menu optimization\r\n\r\n### **For Developers**\r\n1. Examine Python database connection patterns\r\n2. Study Jupyter notebooks for data processing\r\n3. Review booking system implementation\r\n4. Analyze data cleaning and transformation scripts\r\n\r\n## 🏆 Skills Demonstrated\r\n\r\n### **Database Engineering**\r\n- ER/ERD Modeling and Design\r\n- SQL Schema Creation and Optimization\r\n- Stored Procedure Development\r\n- Database Normalization (3NF)\r\n- Referential Integrity Management\r\n\r\n### **Data Analysis**\r\n- SQL Query Optimization\r\n- Data Visualization with Tableau\r\n- Business Intelligence Dashboard Design\r\n- Statistical Analysis of Business Metrics\r\n\r\n### **Programming**\r\n- Python Database Connectivity\r\n- Data Processing and Cleaning\r\n- Jupyter Notebook Development\r\n- Automated Data Generation\r\n\r\n### **Project Management**\r\n- End-to-End Database Implementation\r\n- Documentation and Version Control\r\n- Stakeholder Communication\r\n- Quality Assurance and Testing\r\n\r\n## 📋 Technical Specifications\r\n\r\n### **Database Requirements**\r\n- MySQL 8.0+\r\n- MySQL Workbench for ER modeling\r\n- Python 3.8+ with mysql-connector\r\n- 100MB storage for sample data\r\n\r\n### **Visualization Requirements**\r\n- Tableau Desktop or Tableau Public\r\n- Basic understanding of business metrics\r\n- Screen resolution: 1280x720 minimum\r\n\r\n### **Data Characteristics**\r\n- **Time Period**: 2019-2022 operational data\r\n- **Transactions**: ~50,000 sample records\r\n- **Entities**: 6 primary business tables\r\n- **Relationships**: Complex multi-table joins\r\n\r\n## 📝 Methodology\r\n\r\n### **Design Phase**\r\n1. Requirement gathering and analysis\r\n2. Entity identification and relationship mapping\r\n3. ER diagram creation and validation\r\n4. Normalization to 3rd Normal Form\r\n\r\n### **Implementation Phase**\r\n1. Physical database schema creation\r\n2. Data population and validation\r\n3. Index creation for performance\r\n4. Stored procedure development\r\n\r\n### **Analysis Phase**\r\n1. SQL query development for insights\r\n2. Tableau connection and visualization\r\n3. Dashboard design and interactivity\r\n4. Business insight extraction\r\n\r\n### **Integration Phase**\r\n1. Python database connectivity\r\n2. Automated data processing\r\n3. Client application development\r\n4. System testing and validation\r\n\r\n## 🎨 Design Philosophy\r\n\r\n### **Database Principles**\r\n- **Scalability**: Structure supporting business growth\r\n- **Maintainability**: Clear naming and documentation\r\n- **Performance**: Optimized queries and indexing\r\n- **Security**: Proper access controls and validation\r\n\r\n### **Visualization Best Practices**\r\n- **Clarity**: Clear, understandable charts\r\n- **Relevance**: Business-focused metrics\r\n- **Interactivity**: User-driven exploration\r\n- **Consistency**: Uniform styling and formatting\r\n\r\n### **Code Quality**\r\n- **Readability**: Well-documented code\r\n- **Reusability**: Modular procedures and functions\r\n- **Robustness**: Error handling and validation\r\n- **Efficiency**: Optimized algorithms and queries\r\n\r\n## 🔗 Related Resources\r\n\r\n- [MySQL Documentation](https://dev.mysql.com/doc/)\r\n- [Tableau Learning](https://www.tableau.com/learn)\r\n- [Python Database Programming](https://docs.python.org/3/library/sqlite3.html)\r\n- [Database Design Best Practices](https://www.ibm.com/topics/database-design)\r\n\r\n## 👥 Acknowledgments\r\n\r\n- **Meta** for the comprehensive database engineering curriculum\r\n- **MySQL Community** for robust database tools\r\n- **Tableau** for powerful visualization capabilities\r\n- **Educational Mentors** for guidance and support\r\n\r\n## 📄 License\r\n\r\nThis project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details. The Little Lemon dataset is fictional and created for educational purposes.\r\n\r\n---\r\n\r\n⭐ **This project demonstrates comprehensive database engineering and BI skills applicable to real-world restaurant management systems.** ⭐\r\n\r\n*Project Completed: September 29, 2024*  \r\n*Last Updated: January 28, 2025*\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillie-conway%2Flittle-lemon-database-capstone-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillie-conway%2Flittle-lemon-database-capstone-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillie-conway%2Flittle-lemon-database-capstone-project/lists"}