From 59f2a3b042d017c14738f38f6f83082f41983748 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 11 Feb 2026 03:23:47 +0000
Subject: [PATCH 01/10] Initial plan
From dd880c9fd7d8416119bd7d8c1cce313c06ba4c59 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 11 Feb 2026 03:29:13 +0000
Subject: [PATCH 02/10] Add comprehensive reorganized SQL fundamentals lab
guide
Co-authored-by: khalefa-ow <88914125+khalefa-ow@users.noreply.github.com>
---
Lab_Reorganized_SQL_Fundamentals.md | 1852 +++++++++++++++++++++++++++
1 file changed, 1852 insertions(+)
create mode 100644 Lab_Reorganized_SQL_Fundamentals.md
diff --git a/Lab_Reorganized_SQL_Fundamentals.md b/Lab_Reorganized_SQL_Fundamentals.md
new file mode 100644
index 0000000..e114803
--- /dev/null
+++ b/Lab_Reorganized_SQL_Fundamentals.md
@@ -0,0 +1,1852 @@
+# SQL Fundamentals - Reorganized Lab Guide
+
+## 📚 Table of Contents
+
+1. [Create Tables](#1-create-tables)
+2. [Single Table Query](#2-single-table-query)
+3. [DISTINCT](#3-distinct)
+4. [ORDER BY](#4-order-by)
+5. [Foreign Key](#5-foreign-key)
+6. [Multi Table](#6-multi-table)
+7. [Aggregate Function](#7-aggregate-function)
+8. [GROUP BY](#8-group-by)
+9. [HAVING](#9-having)
+10. [Set Operation](#10-set-operation)
+
+---
+
+## 🎯 Overview
+
+This comprehensive guide covers fundamental SQL concepts in a logical progression, from basic table creation to advanced set operations. Each section builds upon the previous one, providing a structured learning path for database management.
+
+**Prerequisites:**
+- MySQL or MariaDB server installed and running
+- Basic understanding of relational database concepts
+- Access to a SQL client (command line, MySQL Workbench, etc.)
+
+---
+
+## 1. Create Tables
+
+### 1.1 Introduction to Database and Table Creation
+
+A database is a container that holds related tables. Before creating tables, you must first create and select a database.
+
+### 1.2 Create a Database
+
+```sql
+-- Create a new database
+CREATE DATABASE sql_fundamentals;
+
+-- Switch to the database
+USE sql_fundamentals;
+```
+
+**Note:** Database names are case-sensitive on some systems. Use lowercase for consistency.
+
+### 1.3 Understanding Data Types
+
+Common MySQL data types:
+- `INT`: Integer numbers
+- `DECIMAL(p,s)`: Fixed-point numbers (e.g., DECIMAL(10,2) for prices)
+- `VARCHAR(n)`: Variable-length strings up to n characters
+- `CHAR(n)`: Fixed-length strings
+- `DATE`: Date values (YYYY-MM-DD)
+- `DATETIME`: Date and time values
+- `TEXT`: Long text fields
+
+### 1.4 Create Your First Table
+
+```sql
+-- Create a product table
+CREATE TABLE product(
+ pname VARCHAR(20) PRIMARY KEY, -- Product name (unique identifier)
+ price DECIMAL(10,2), -- Price with 2 decimal places
+ category VARCHAR(20), -- Product category
+ manufacturer VARCHAR(20) NOT NULL -- Manufacturer (required field)
+);
+```
+
+**Key Concepts:**
+- `PRIMARY KEY`: Ensures each value is unique and not null
+- `NOT NULL`: Field cannot be empty
+- `DECIMAL(10,2)`: Stores numbers with up to 10 digits, 2 after decimal point
+- `VARCHAR(20)`: Variable-length string up to 20 characters
+
+### 1.5 Insert Sample Data
+
+```sql
+-- Insert sample products
+INSERT INTO product VALUES('Gizmo', 19.99, 'Gadgets', 'GizmoWorks');
+INSERT INTO product VALUES('PowerGizmo', 29.99, 'Gadgets', 'GizmoWorks');
+INSERT INTO product VALUES('MultiTouch', 203.99, 'Household', 'Hitachi');
+INSERT INTO product VALUES('SingleTouch', 149.99, 'Photography', 'Canon');
+INSERT INTO product VALUES('SuperGizmo', 49.99, 'Gadgets', 'GizmoWorks');
+INSERT INTO product VALUES('UltraTouch', 99.99, 'Photography', 'Nikon');
+```
+
+### 1.6 Verify Your Data
+
+```sql
+-- View all products
+SELECT * FROM product;
+```
+
+**Expected Output:**
+```
++-------------+--------+-------------+--------------+
+| pname | price | category | manufacturer |
++-------------+--------+-------------+--------------+
+| Gizmo | 19.99 | Gadgets | GizmoWorks |
+| PowerGizmo | 29.99 | Gadgets | GizmoWorks |
+| MultiTouch | 203.99 | Household | Hitachi |
+| SingleTouch | 149.99 | Photography | Canon |
+| SuperGizmo | 49.99 | Gadgets | GizmoWorks |
+| UltraTouch | 99.99 | Photography | Nikon |
++-------------+--------+-------------+--------------+
+```
+
+### 1.7 Additional Table Creation Examples
+
+```sql
+-- Create a company table
+CREATE TABLE company(
+ cname VARCHAR(20) PRIMARY KEY,
+ city VARCHAR(20),
+ country VARCHAR(20)
+);
+
+-- Insert company data
+INSERT INTO company VALUES('GizmoWorks', 'Seattle', 'USA');
+INSERT INTO company VALUES('Canon', 'Tokyo', 'Japan');
+INSERT INTO company VALUES('Hitachi', 'Osaka', 'Japan');
+INSERT INTO company VALUES('Nikon', 'Tokyo', 'Japan');
+```
+
+### 1.8 Practice Exercises
+
+**Exercise 1:** Create a `customer` table with the following columns:
+- `customer_id` (INT, PRIMARY KEY)
+- `first_name` (VARCHAR(50), NOT NULL)
+- `last_name` (VARCHAR(50), NOT NULL)
+- `email` (VARCHAR(100))
+- `city` (VARCHAR(50))
+
+**Exercise 2:** Create an `orders` table with columns for order_id, customer_id, order_date, and total_amount.
+
+---
+
+## 2. Single Table Query
+
+### 2.1 Introduction to SELECT
+
+The SELECT statement is used to query data from a database. The simplest form retrieves all columns from a table.
+
+### 2.2 Basic SELECT Syntax
+
+```sql
+SELECT column1, column2, ...
+FROM table_name;
+```
+
+### 2.3 Retrieve All Columns
+
+```sql
+-- Select all columns from product table
+SELECT * FROM product;
+```
+
+**Note:** While `SELECT *` is convenient for exploration, it's better to explicitly list columns in production queries for clarity and performance.
+
+### 2.4 Select Specific Columns
+
+```sql
+-- Select only product name and price
+SELECT pname, price FROM product;
+
+-- Select product name and category
+SELECT pname, category FROM product;
+```
+
+### 2.5 WHERE Clause - Filtering Data
+
+The WHERE clause filters records based on specified conditions.
+
+```sql
+-- Find products in the Gadgets category
+SELECT * FROM product
+WHERE category = 'Gadgets';
+
+-- Find products priced over $50
+SELECT pname, price FROM product
+WHERE price > 50;
+
+-- Find products from GizmoWorks
+SELECT * FROM product
+WHERE manufacturer = 'GizmoWorks';
+```
+
+### 2.6 Comparison Operators
+
+```sql
+-- Equal to
+SELECT * FROM product WHERE category = 'Photography';
+
+-- Greater than
+SELECT * FROM product WHERE price > 100;
+
+-- Less than or equal to
+SELECT * FROM product WHERE price <= 50;
+
+-- Not equal to
+SELECT * FROM product WHERE category != 'Gadgets';
+-- or
+SELECT * FROM product WHERE category <> 'Gadgets';
+```
+
+### 2.7 Logical Operators (AND, OR, NOT)
+
+```sql
+-- AND: Both conditions must be true
+SELECT * FROM product
+WHERE category = 'Gadgets' AND price < 30;
+
+-- OR: At least one condition must be true
+SELECT * FROM product
+WHERE category = 'Gadgets' OR category = 'Photography';
+
+-- NOT: Negates a condition
+SELECT * FROM product
+WHERE NOT category = 'Gadgets';
+```
+
+### 2.8 BETWEEN Operator
+
+```sql
+-- Find products priced between $20 and $100
+SELECT * FROM product
+WHERE price BETWEEN 20 AND 100;
+```
+
+### 2.9 IN Operator
+
+```sql
+-- Find products in specific categories
+SELECT * FROM product
+WHERE category IN ('Gadgets', 'Photography');
+
+-- Find products from specific manufacturers
+SELECT * FROM product
+WHERE manufacturer IN ('Canon', 'Nikon');
+```
+
+### 2.10 LIKE Operator - Pattern Matching
+
+```sql
+-- Find products whose name contains 'Gizmo'
+SELECT * FROM product
+WHERE pname LIKE '%Gizmo%';
+
+-- Find products starting with 'Multi'
+SELECT * FROM product
+WHERE pname LIKE 'Multi%';
+
+-- Find products ending with 'Touch'
+SELECT * FROM product
+WHERE pname LIKE '%Touch';
+```
+
+**Wildcards:**
+- `%` : Matches any sequence of characters
+- `_` : Matches a single character
+
+### 2.11 NULL Values
+
+```sql
+-- Find products with no price specified
+SELECT * FROM product
+WHERE price IS NULL;
+
+-- Find products with a price specified
+SELECT * FROM product
+WHERE price IS NOT NULL;
+```
+
+### 2.12 Practice Exercises
+
+**Exercise 1:** Write a query to find all products that cost more than $100.
+
+**Exercise 2:** Write a query to find all products in the 'Photography' category made by Canon.
+
+**Exercise 3:** Write a query to find all products whose name starts with 'Super'.
+
+---
+
+## 3. DISTINCT
+
+### 3.1 Introduction to DISTINCT
+
+The DISTINCT keyword is used to return only unique (different) values, eliminating duplicate rows from the result set.
+
+### 3.2 Basic DISTINCT Syntax
+
+```sql
+SELECT DISTINCT column1, column2, ...
+FROM table_name;
+```
+
+### 3.3 Find Unique Categories
+
+```sql
+-- Without DISTINCT - shows duplicates
+SELECT category FROM product;
+
+-- With DISTINCT - shows only unique categories
+SELECT DISTINCT category FROM product;
+```
+
+**Output without DISTINCT:**
+```
++-------------+
+| category |
++-------------+
+| Gadgets |
+| Gadgets |
+| Household |
+| Photography |
+| Gadgets |
+| Photography |
++-------------+
+```
+
+**Output with DISTINCT:**
+```
++-------------+
+| category |
++-------------+
+| Gadgets |
+| Household |
+| Photography |
++-------------+
+```
+
+### 3.4 Find Unique Manufacturers
+
+```sql
+-- Get list of unique manufacturers
+SELECT DISTINCT manufacturer FROM product;
+```
+
+### 3.5 DISTINCT with Multiple Columns
+
+When you use DISTINCT with multiple columns, it returns unique combinations of those columns.
+
+```sql
+-- Get unique combinations of category and manufacturer
+SELECT DISTINCT category, manufacturer FROM product;
+```
+
+### 3.6 COUNT with DISTINCT
+
+```sql
+-- Count how many different categories exist
+SELECT COUNT(DISTINCT category) AS unique_categories FROM product;
+
+-- Count how many different manufacturers exist
+SELECT COUNT(DISTINCT manufacturer) AS unique_manufacturers FROM product;
+```
+
+### 3.7 Important Notes About DISTINCT
+
+**Note 1:** DISTINCT applies to all selected columns, not just one.
+
+```sql
+-- This finds unique combinations of pname AND category
+SELECT DISTINCT pname, category FROM product;
+```
+
+**Note 2:** DISTINCT can affect performance on large tables. Use it only when necessary.
+
+**Note 3:** DISTINCT removes only exact duplicate rows. NULL values are considered equal for DISTINCT purposes.
+
+### 3.8 Practice Exercises
+
+**Exercise 1:** Find all unique cities where companies are located.
+
+**Exercise 2:** Count how many different countries have companies in the database.
+
+**Exercise 3:** Find unique combinations of category and price from the product table.
+
+---
+
+## 4. ORDER BY
+
+### 4.1 Introduction to ORDER BY
+
+The ORDER BY clause is used to sort the result set in ascending or descending order.
+
+### 4.2 Basic ORDER BY Syntax
+
+```sql
+SELECT column1, column2, ...
+FROM table_name
+ORDER BY column1 [ASC|DESC], column2 [ASC|DESC], ...;
+```
+
+- `ASC`: Ascending order (default)
+- `DESC`: Descending order
+
+### 4.3 Sort by Single Column
+
+```sql
+-- Sort products by price (ascending - lowest to highest)
+SELECT * FROM product
+ORDER BY price;
+
+-- Sort products by price (descending - highest to lowest)
+SELECT * FROM product
+ORDER BY price DESC;
+
+-- Sort products by name (alphabetically)
+SELECT * FROM product
+ORDER BY pname;
+```
+
+### 4.4 Sort by Multiple Columns
+
+```sql
+-- Sort by category first, then by price within each category
+SELECT * FROM product
+ORDER BY category, price;
+
+-- Sort by category (ascending) and price (descending)
+SELECT * FROM product
+ORDER BY category ASC, price DESC;
+```
+
+### 4.5 Combining WHERE and ORDER BY
+
+```sql
+-- Find Gadgets and sort by price
+SELECT * FROM product
+WHERE category = 'Gadgets'
+ORDER BY price;
+
+-- Find products over $50 and sort by manufacturer
+SELECT * FROM product
+WHERE price > 50
+ORDER BY manufacturer;
+```
+
+### 4.6 ORDER BY with Column Position
+
+You can use column position numbers instead of names:
+
+```sql
+-- Sort by the first column in SELECT list
+SELECT pname, price, category FROM product
+ORDER BY 1; -- Orders by pname
+
+-- Sort by the second column
+SELECT pname, price, category FROM product
+ORDER BY 2; -- Orders by price
+```
+
+**Note:** Using column positions is less readable and not recommended in production code.
+
+### 4.7 Combining DISTINCT and ORDER BY
+
+```sql
+-- Get unique categories and sort them
+SELECT DISTINCT category FROM product
+ORDER BY category;
+
+-- Get unique manufacturers and sort them
+SELECT DISTINCT manufacturer FROM product
+ORDER BY manufacturer;
+```
+
+### 4.8 Important Rule: ORDER BY with DISTINCT
+
+When using DISTINCT, you can only ORDER BY columns that appear in the SELECT clause.
+
+```sql
+-- This works - pname is in the SELECT list
+SELECT DISTINCT category FROM product
+ORDER BY category;
+
+-- This will produce an ERROR - pname is not in the SELECT list
+-- SELECT DISTINCT category FROM product
+-- ORDER BY pname;
+```
+
+**Key Learning:** When using DISTINCT, you can only ORDER BY columns that are in the SELECT clause.
+
+### 4.9 NULL Values in ORDER BY
+
+- `ASC`: NULL values appear first
+- `DESC`: NULL values appear last
+
+```sql
+-- Sort with NULLs first (default for ASC)
+SELECT * FROM product
+ORDER BY price ASC;
+
+-- Sort with NULLs last (default for DESC)
+SELECT * FROM product
+ORDER BY price DESC;
+```
+
+### 4.10 Practice Exercises
+
+**Exercise 1:** List all products sorted by manufacturer name, then by price (descending) within each manufacturer.
+
+**Exercise 2:** Find all products in the Photography category and sort them by price from highest to lowest.
+
+**Exercise 3:** List unique categories sorted alphabetically.
+
+---
+
+## 5. Foreign Key
+
+### 5.1 Introduction to Foreign Keys
+
+A foreign key is a field (or collection of fields) in one table that refers to the primary key in another table. Foreign keys are used to establish and enforce relationships between tables, ensuring referential integrity.
+
+### 5.2 Why Use Foreign Keys?
+
+**Benefits:**
+- **Data Integrity**: Prevents invalid data from being inserted
+- **Referential Integrity**: Ensures relationships between tables remain consistent
+- **Cascading Actions**: Automatically handle related records when parent records are updated or deleted
+- **Documentation**: Makes database relationships explicit and clear
+
+### 5.3 Creating Tables with Foreign Keys
+
+Let's create a complete example with companies and products:
+
+```sql
+-- First, create the parent table (company)
+CREATE TABLE company(
+ cname VARCHAR(20) PRIMARY KEY,
+ city VARCHAR(20),
+ country VARCHAR(20)
+);
+
+-- Then, create the child table (product) with a foreign key
+CREATE TABLE product_fk(
+ pname VARCHAR(20) PRIMARY KEY,
+ price DECIMAL(10,2),
+ category VARCHAR(20),
+ manufacturer VARCHAR(20) NOT NULL,
+ FOREIGN KEY (manufacturer) REFERENCES company(cname)
+);
+```
+
+**Key Points:**
+- The `company` table must be created first (parent table)
+- The `product_fk` table references `company` through the manufacturer field
+- The foreign key ensures that every manufacturer in product_fk must exist in company
+
+### 5.4 Insert Data with Foreign Key Constraints
+
+```sql
+-- First, insert companies (parent records)
+INSERT INTO company VALUES('GizmoWorks', 'Seattle', 'USA');
+INSERT INTO company VALUES('Canon', 'Tokyo', 'Japan');
+INSERT INTO company VALUES('Hitachi', 'Osaka', 'Japan');
+
+-- Now insert products (child records)
+INSERT INTO product_fk VALUES('Gizmo', 19.99, 'Gadgets', 'GizmoWorks');
+INSERT INTO product_fk VALUES('MultiTouch', 203.99, 'Household', 'Hitachi');
+INSERT INTO product_fk VALUES('SingleTouch', 149.99, 'Photography', 'Canon');
+```
+
+### 5.5 Foreign Key Constraint Violations
+
+```sql
+-- This will FAIL because 'UnknownCompany' doesn't exist in company table
+-- INSERT INTO product_fk VALUES('BadProduct', 99.99, 'Gadgets', 'UnknownCompany');
+-- Error: Cannot add or update a child row: a foreign key constraint fails
+```
+
+**Error Prevention:** Always ensure parent records exist before inserting child records.
+
+### 5.6 CASCADE Options
+
+CASCADE options define what happens to child records when parent records are modified or deleted.
+
+#### 5.6.1 ON DELETE CASCADE
+
+```sql
+-- Create tables with ON DELETE CASCADE
+CREATE TABLE company_cascade(
+ cname VARCHAR(20) PRIMARY KEY,
+ city VARCHAR(20),
+ country VARCHAR(20)
+);
+
+CREATE TABLE product_cascade(
+ pname VARCHAR(20) PRIMARY KEY,
+ price DECIMAL(10,2),
+ category VARCHAR(20),
+ manufacturer VARCHAR(20) NOT NULL,
+ FOREIGN KEY (manufacturer) REFERENCES company_cascade(cname)
+ ON DELETE CASCADE
+);
+```
+
+**Behavior:** When a company is deleted, all its products are automatically deleted.
+
+```sql
+-- Insert data
+INSERT INTO company_cascade VALUES('TempCompany', 'Boston', 'USA');
+INSERT INTO product_cascade VALUES('TempProduct', 50.00, 'Test', 'TempCompany');
+
+-- Delete company - product is also deleted automatically
+DELETE FROM company_cascade WHERE cname = 'TempCompany';
+```
+
+#### 5.6.2 ON UPDATE CASCADE
+
+```sql
+CREATE TABLE product_update_cascade(
+ pname VARCHAR(20) PRIMARY KEY,
+ price DECIMAL(10,2),
+ category VARCHAR(20),
+ manufacturer VARCHAR(20) NOT NULL,
+ FOREIGN KEY (manufacturer) REFERENCES company_cascade(cname)
+ ON UPDATE CASCADE
+);
+```
+
+**Behavior:** When a company name is updated, all product manufacturer references are automatically updated.
+
+#### 5.6.3 Other CASCADE Options
+
+- `ON DELETE SET NULL`: Sets foreign key to NULL when parent is deleted
+- `ON DELETE RESTRICT`: Prevents deletion of parent if children exist (default)
+- `ON UPDATE RESTRICT`: Prevents update of parent key if children exist (default)
+- `ON DELETE NO ACTION`: Similar to RESTRICT
+- `ON UPDATE NO ACTION`: Similar to RESTRICT
+
+### 5.7 Viewing Foreign Key Constraints
+
+```sql
+-- Show table structure including foreign keys
+SHOW CREATE TABLE product_fk;
+
+-- Show all foreign keys in current database
+SELECT
+ TABLE_NAME,
+ COLUMN_NAME,
+ CONSTRAINT_NAME,
+ REFERENCED_TABLE_NAME,
+ REFERENCED_COLUMN_NAME
+FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
+WHERE TABLE_SCHEMA = 'sql_fundamentals'
+ AND REFERENCED_TABLE_NAME IS NOT NULL;
+```
+
+### 5.8 Multiple Foreign Keys
+
+A table can have multiple foreign keys referencing different tables:
+
+```sql
+-- Create an orders table with multiple foreign keys
+CREATE TABLE orders(
+ order_id INT PRIMARY KEY AUTO_INCREMENT,
+ customer_id INT NOT NULL,
+ product_name VARCHAR(20) NOT NULL,
+ order_date DATE,
+ quantity INT,
+ FOREIGN KEY (customer_id) REFERENCES customer(customer_id),
+ FOREIGN KEY (product_name) REFERENCES product_fk(pname)
+);
+```
+
+### 5.9 Composite Foreign Keys
+
+Foreign keys can reference composite primary keys:
+
+```sql
+-- Example with composite primary key
+CREATE TABLE enrollment(
+ student_id INT,
+ course_id INT,
+ semester VARCHAR(20),
+ grade CHAR(2),
+ PRIMARY KEY (student_id, course_id, semester),
+ FOREIGN KEY (student_id) REFERENCES student(id),
+ FOREIGN KEY (course_id) REFERENCES course(id)
+);
+```
+
+### 5.10 Practice Exercises
+
+**Exercise 1:** Create a `customer` table and an `orders` table where orders reference customers through a foreign key.
+
+**Exercise 2:** Add foreign key constraints to existing tables (if they don't have them).
+
+**Exercise 3:** Create tables with ON DELETE CASCADE and test the cascading behavior.
+
+**Exercise 4:** Try to insert a record with an invalid foreign key reference and observe the error message.
+
+---
+
+## 6. Multi Table
+
+### 6.1 Introduction to Multi-Table Queries
+
+Real-world databases typically have multiple related tables. Multi-table queries allow us to combine data from two or more tables to answer complex questions.
+
+### 6.2 Understanding JOINs
+
+JOINs are used to combine rows from two or more tables based on a related column between them.
+
+**Types of JOINs:**
+- **INNER JOIN**: Returns records that have matching values in both tables
+- **LEFT JOIN (LEFT OUTER JOIN)**: Returns all records from the left table and matched records from the right
+- **RIGHT JOIN (RIGHT OUTER JOIN)**: Returns all records from the right table and matched records from the left
+- **CROSS JOIN**: Returns the Cartesian product of both tables
+
+### 6.3 Preparing Sample Data
+
+```sql
+-- Use our existing product and company tables
+-- Ensure data is present
+SELECT * FROM product;
+SELECT * FROM company;
+```
+
+### 6.4 INNER JOIN
+
+INNER JOIN returns only the rows where there is a match in both tables.
+
+```sql
+-- Join products with their company information
+SELECT p.pname, p.price, p.category, c.city, c.country
+FROM product p
+INNER JOIN company c ON p.manufacturer = c.cname;
+```
+
+**Explanation:**
+- `p` and `c` are table aliases for easier reference
+- `ON p.manufacturer = c.cname` specifies the join condition
+- Only products with a matching company are returned
+
+### 6.5 Alternative JOIN Syntax
+
+```sql
+-- Using USING clause (when column names are identical)
+SELECT p.pname, p.price, c.city, c.country
+FROM product p
+INNER JOIN company c USING (cname);
+
+-- Traditional comma syntax (older style, not recommended)
+SELECT p.pname, p.price, c.city, c.country
+FROM product p, company c
+WHERE p.manufacturer = c.cname;
+```
+
+### 6.6 LEFT JOIN (LEFT OUTER JOIN)
+
+LEFT JOIN returns all records from the left table, and matched records from the right table. If there's no match, NULL values are returned for the right table.
+
+```sql
+-- Get all products, including those without a matching company
+SELECT p.pname, p.price, p.manufacturer, c.city, c.country
+FROM product p
+LEFT JOIN company c ON p.manufacturer = c.cname;
+```
+
+**Use Case:** Find products that don't have a company entry:
+```sql
+SELECT p.pname, p.manufacturer
+FROM product p
+LEFT JOIN company c ON p.manufacturer = c.cname
+WHERE c.cname IS NULL;
+```
+
+### 6.7 RIGHT JOIN (RIGHT OUTER JOIN)
+
+RIGHT JOIN returns all records from the right table, and matched records from the left table.
+
+```sql
+-- Get all companies, including those without products
+SELECT c.cname, c.city, p.pname, p.price
+FROM product p
+RIGHT JOIN company c ON p.manufacturer = c.cname;
+```
+
+**Use Case:** Find companies that don't have any products:
+```sql
+SELECT c.cname, c.city
+FROM product p
+RIGHT JOIN company c ON p.manufacturer = c.cname
+WHERE p.pname IS NULL;
+```
+
+### 6.8 Joining More Than Two Tables
+
+```sql
+-- Create an additional table for demonstration
+CREATE TABLE sales(
+ sale_id INT PRIMARY KEY AUTO_INCREMENT,
+ product_name VARCHAR(20),
+ sale_date DATE,
+ quantity INT,
+ FOREIGN KEY (product_name) REFERENCES product(pname)
+);
+
+-- Insert sample sales data
+INSERT INTO sales (product_name, sale_date, quantity)
+VALUES ('Gizmo', '2024-01-15', 5);
+INSERT INTO sales (product_name, sale_date, quantity)
+VALUES ('MultiTouch', '2024-01-16', 2);
+INSERT INTO sales (product_name, sale_date, quantity)
+VALUES ('Gizmo', '2024-01-17', 3);
+
+-- Join three tables
+SELECT
+ s.sale_id,
+ s.sale_date,
+ p.pname,
+ p.category,
+ c.cname AS manufacturer,
+ c.city,
+ s.quantity
+FROM sales s
+INNER JOIN product p ON s.product_name = p.pname
+INNER JOIN company c ON p.manufacturer = c.cname;
+```
+
+### 6.9 Self-Join
+
+A self-join is when a table is joined with itself. This is useful for hierarchical data.
+
+```sql
+-- Create an employee table with manager references
+CREATE TABLE employee(
+ emp_id INT PRIMARY KEY,
+ emp_name VARCHAR(50),
+ manager_id INT,
+ FOREIGN KEY (manager_id) REFERENCES employee(emp_id)
+);
+
+-- Insert sample data
+INSERT INTO employee VALUES(1, 'Alice', NULL); -- CEO, no manager
+INSERT INTO employee VALUES(2, 'Bob', 1); -- Reports to Alice
+INSERT INTO employee VALUES(3, 'Charlie', 1); -- Reports to Alice
+INSERT INTO employee VALUES(4, 'David', 2); -- Reports to Bob
+INSERT INTO employee VALUES(5, 'Eve', 2); -- Reports to Bob
+
+-- Self-join to show employees with their managers
+SELECT
+ e.emp_name AS employee,
+ m.emp_name AS manager
+FROM employee e
+LEFT JOIN employee m ON e.manager_id = m.emp_id;
+```
+
+### 6.10 CROSS JOIN
+
+CROSS JOIN produces a Cartesian product - every row from the first table combined with every row from the second table.
+
+```sql
+-- Get all possible combinations of products and companies
+SELECT p.pname, c.cname
+FROM product p
+CROSS JOIN company c;
+```
+
+**Warning:** CROSS JOIN can produce very large result sets. Use with caution.
+
+### 6.11 Filtering Multi-Table Results
+
+```sql
+-- Find products made by Japanese companies
+SELECT p.pname, p.price, c.cname, c.country
+FROM product p
+INNER JOIN company c ON p.manufacturer = c.cname
+WHERE c.country = 'Japan';
+
+-- Find products in Gadgets category with company in USA
+SELECT p.pname, p.price, c.cname, c.city
+FROM product p
+INNER JOIN company c ON p.manufacturer = c.cname
+WHERE p.category = 'Gadgets' AND c.country = 'USA';
+```
+
+### 6.12 Combining Joins and Sorting
+
+```sql
+-- Get products with companies, sorted by country and price
+SELECT p.pname, p.price, c.cname, c.country
+FROM product p
+INNER JOIN company c ON p.manufacturer = c.cname
+ORDER BY c.country, p.price DESC;
+```
+
+### 6.13 Practice Exercises
+
+**Exercise 1:** Write a query to find all products along with their manufacturer's city and country.
+
+**Exercise 2:** Find all companies that manufacture products in the 'Photography' category.
+
+**Exercise 3:** List all products made by companies in Japan, sorted by price.
+
+**Exercise 4:** Create a query that shows employee names along with their manager names (use self-join).
+
+**Exercise 5:** Find companies that don't have any products in the database.
+
+---
+
+## 7. Aggregate Function
+
+### 7.1 Introduction to Aggregate Functions
+
+Aggregate functions perform a calculation on a set of values and return a single value. They are essential for data analysis and reporting.
+
+**Common Aggregate Functions:**
+- `COUNT()`: Returns the number of rows
+- `SUM()`: Returns the sum of values
+- `AVG()`: Returns the average of values
+- `MAX()`: Returns the maximum value
+- `MIN()`: Returns the minimum value
+
+### 7.2 COUNT Function
+
+```sql
+-- Count total number of products
+SELECT COUNT(*) AS total_products FROM product;
+
+-- Count products in a specific category
+SELECT COUNT(*) AS gadget_count
+FROM product
+WHERE category = 'Gadgets';
+
+-- Count non-NULL values in a column
+SELECT COUNT(price) AS products_with_price FROM product;
+
+-- Count distinct values
+SELECT COUNT(DISTINCT category) AS unique_categories FROM product;
+SELECT COUNT(DISTINCT manufacturer) AS unique_manufacturers FROM product;
+```
+
+**COUNT(*) vs COUNT(column):**
+- `COUNT(*)`: Counts all rows, including those with NULL values
+- `COUNT(column)`: Counts only non-NULL values in that column
+
+### 7.3 SUM Function
+
+```sql
+-- Calculate total value of all products
+SELECT SUM(price) AS total_value FROM product;
+
+-- Calculate total value of products in a specific category
+SELECT SUM(price) AS gadgets_total_value
+FROM product
+WHERE category = 'Gadgets';
+
+-- Sum with calculation
+SELECT SUM(price * 1.1) AS total_with_tax FROM product;
+```
+
+**Note:** SUM() ignores NULL values.
+
+### 7.4 AVG Function
+
+```sql
+-- Calculate average product price
+SELECT AVG(price) AS average_price FROM product;
+
+-- Calculate average price by category
+SELECT AVG(price) AS avg_gadget_price
+FROM product
+WHERE category = 'Gadgets';
+
+-- Round the average to 2 decimal places
+SELECT ROUND(AVG(price), 2) AS avg_price FROM product;
+```
+
+**Note:** AVG() ignores NULL values. To include NULLs as zeros, use: `AVG(COALESCE(price, 0))`
+
+### 7.5 MAX and MIN Functions
+
+```sql
+-- Find highest priced product
+SELECT MAX(price) AS highest_price FROM product;
+
+-- Find lowest priced product
+SELECT MIN(price) AS lowest_price FROM product;
+
+-- Find price range
+SELECT
+ MIN(price) AS min_price,
+ MAX(price) AS max_price,
+ MAX(price) - MIN(price) AS price_range
+FROM product;
+```
+
+**Note:** MAX() and MIN() work with numbers, dates, and strings (alphabetical order).
+
+### 7.6 Multiple Aggregate Functions
+
+```sql
+-- Get comprehensive statistics
+SELECT
+ COUNT(*) AS total_products,
+ COUNT(DISTINCT category) AS unique_categories,
+ MIN(price) AS min_price,
+ MAX(price) AS max_price,
+ AVG(price) AS avg_price,
+ SUM(price) AS total_value
+FROM product;
+```
+
+### 7.7 Aggregates with WHERE Clause
+
+```sql
+-- Statistics for Gadgets category only
+SELECT
+ COUNT(*) AS count,
+ MIN(price) AS min_price,
+ MAX(price) AS max_price,
+ AVG(price) AS avg_price
+FROM product
+WHERE category = 'Gadgets';
+```
+
+### 7.8 Aggregates with Joins
+
+```sql
+-- Count products by country
+SELECT
+ c.country,
+ COUNT(p.pname) AS product_count,
+ AVG(p.price) AS avg_price
+FROM company c
+LEFT JOIN product p ON c.cname = p.manufacturer
+GROUP BY c.country;
+```
+
+### 7.9 String Aggregation
+
+```sql
+-- MySQL specific: GROUP_CONCAT
+SELECT
+ category,
+ GROUP_CONCAT(pname ORDER BY pname SEPARATOR ', ') AS products
+FROM product
+GROUP BY category;
+```
+
+### 7.10 Conditional Aggregation
+
+```sql
+-- Count products above and below average price
+SELECT
+ COUNT(CASE WHEN price > (SELECT AVG(price) FROM product)
+ THEN 1 END) AS above_avg_count,
+ COUNT(CASE WHEN price <= (SELECT AVG(price) FROM product)
+ THEN 1 END) AS below_avg_count
+FROM product;
+```
+
+### 7.11 NULL Handling in Aggregates
+
+```sql
+-- Demonstrate NULL handling
+CREATE TABLE test_nulls(
+ id INT,
+ value DECIMAL(10,2)
+);
+
+INSERT INTO test_nulls VALUES(1, 10.00);
+INSERT INTO test_nulls VALUES(2, 20.00);
+INSERT INTO test_nulls VALUES(3, NULL);
+INSERT INTO test_nulls VALUES(4, 30.00);
+
+-- Compare different functions with NULL
+SELECT
+ COUNT(*) AS count_all, -- Returns 4
+ COUNT(value) AS count_values, -- Returns 3 (excludes NULL)
+ SUM(value) AS sum_values, -- Returns 60 (excludes NULL)
+ AVG(value) AS avg_values -- Returns 20 (60/3, excludes NULL)
+FROM test_nulls;
+```
+
+### 7.12 Practice Exercises
+
+**Exercise 1:** Find the total number of products and their total value.
+
+**Exercise 2:** Calculate the average price of products for each manufacturer.
+
+**Exercise 3:** Find the highest and lowest priced products in the Photography category.
+
+**Exercise 4:** Count how many products each company manufactures.
+
+**Exercise 5:** Calculate the average price difference between Gadgets and Photography products.
+
+---
+
+## 8. GROUP BY
+
+### 8.1 Introduction to GROUP BY
+
+The GROUP BY clause groups rows that have the same values in specified columns into summary rows. It's typically used with aggregate functions to produce summary reports.
+
+### 8.2 Basic GROUP BY Syntax
+
+```sql
+SELECT column1, aggregate_function(column2)
+FROM table_name
+WHERE condition
+GROUP BY column1;
+```
+
+### 8.3 Simple GROUP BY Examples
+
+```sql
+-- Count products in each category
+SELECT category, COUNT(*) AS product_count
+FROM product
+GROUP BY category;
+
+-- Average price by category
+SELECT category, AVG(price) AS avg_price
+FROM product
+GROUP BY category;
+
+-- Count products by manufacturer
+SELECT manufacturer, COUNT(*) AS product_count
+FROM product
+GROUP BY manufacturer;
+```
+
+**Expected Output Example:**
+```
++-------------+---------------+
+| category | product_count |
++-------------+---------------+
+| Gadgets | 3 |
+| Household | 1 |
+| Photography | 2 |
++-------------+---------------+
+```
+
+### 8.4 GROUP BY with Multiple Columns
+
+```sql
+-- Count products by category and manufacturer
+SELECT
+ category,
+ manufacturer,
+ COUNT(*) AS product_count
+FROM product
+GROUP BY category, manufacturer
+ORDER BY category, manufacturer;
+```
+
+### 8.5 GROUP BY with Multiple Aggregates
+
+```sql
+-- Comprehensive statistics by category
+SELECT
+ category,
+ COUNT(*) AS product_count,
+ MIN(price) AS min_price,
+ MAX(price) AS max_price,
+ AVG(price) AS avg_price,
+ SUM(price) AS total_value
+FROM product
+GROUP BY category;
+```
+
+### 8.6 GROUP BY with WHERE Clause
+
+The WHERE clause filters rows BEFORE grouping occurs.
+
+```sql
+-- Average price by category for products over $50
+SELECT
+ category,
+ COUNT(*) AS count,
+ AVG(price) AS avg_price
+FROM product
+WHERE price > 50
+GROUP BY category;
+```
+
+**Important:** WHERE filters individual rows before aggregation.
+
+### 8.7 GROUP BY with Joins
+
+```sql
+-- Count products by country
+SELECT
+ c.country,
+ COUNT(p.pname) AS product_count,
+ AVG(p.price) AS avg_price
+FROM company c
+LEFT JOIN product p ON c.cname = p.manufacturer
+GROUP BY c.country;
+```
+
+### 8.8 GROUP BY with ORDER BY
+
+```sql
+-- Products per category, sorted by count (descending)
+SELECT
+ category,
+ COUNT(*) AS product_count
+FROM product
+GROUP BY category
+ORDER BY product_count DESC;
+
+-- Average price by manufacturer, sorted alphabetically
+SELECT
+ manufacturer,
+ AVG(price) AS avg_price
+FROM product
+GROUP BY manufacturer
+ORDER BY manufacturer;
+```
+
+### 8.9 GROUP BY Rules and Best Practices
+
+**Rule 1:** Every column in the SELECT list must either:
+- Be in the GROUP BY clause, OR
+- Be used in an aggregate function
+
+```sql
+-- CORRECT: pname is in GROUP BY
+SELECT category, COUNT(*) AS count
+FROM product
+GROUP BY category;
+
+-- INCORRECT: pname is not in GROUP BY and not aggregated
+-- SELECT category, pname, COUNT(*) AS count
+-- FROM product
+-- GROUP BY category;
+```
+
+**Rule 2:** You can use column positions instead of names:
+
+```sql
+-- Group by first column in SELECT
+SELECT category, COUNT(*) AS count
+FROM product
+GROUP BY 1;
+```
+
+**Best Practice:** Use column names for better readability.
+
+### 8.10 GROUP BY with DISTINCT
+
+```sql
+-- Count distinct manufacturers per category
+SELECT
+ category,
+ COUNT(DISTINCT manufacturer) AS manufacturer_count
+FROM product
+GROUP BY category;
+```
+
+### 8.11 GROUP BY with Calculated Fields
+
+```sql
+-- Group by price range
+SELECT
+ CASE
+ WHEN price < 50 THEN 'Budget'
+ WHEN price BETWEEN 50 AND 150 THEN 'Mid-range'
+ ELSE 'Premium'
+ END AS price_range,
+ COUNT(*) AS product_count,
+ AVG(price) AS avg_price
+FROM product
+GROUP BY price_range
+ORDER BY avg_price;
+```
+
+### 8.12 Grouping with NULL Values
+
+```sql
+-- NULL values are grouped together
+SELECT
+ category,
+ COUNT(*) AS count
+FROM product
+GROUP BY category;
+-- Products with NULL category will be in one group
+```
+
+### 8.13 GROUP BY Performance Considerations
+
+- Indexes on GROUP BY columns can improve performance
+- GROUP BY can be memory-intensive with many groups
+- Consider using LIMIT with ORDER BY for large result sets
+
+### 8.14 Practice Exercises
+
+**Exercise 1:** Group products by manufacturer and show the count and average price for each.
+
+**Exercise 2:** Find the number of products in each category, but only for categories with more than 1 product.
+
+**Exercise 3:** Group products by price range (e.g., 0-50, 51-100, 101+) and count how many fall in each range.
+
+**Exercise 4:** Show the total value of products for each manufacturer, sorted by total value descending.
+
+**Exercise 5:** Find the average price per country (using joins with the company table).
+
+---
+
+## 9. HAVING
+
+### 9.1 Introduction to HAVING
+
+The HAVING clause filters groups AFTER aggregation has occurred. While WHERE filters individual rows before grouping, HAVING filters the grouped results.
+
+### 9.2 Difference Between WHERE and HAVING
+
+| Clause | When Applied | What It Filters | Can Use Aggregates |
+|--------|--------------|-----------------|-------------------|
+| WHERE | Before GROUP BY | Individual rows | No |
+| HAVING | After GROUP BY | Grouped results | Yes |
+
+### 9.3 Basic HAVING Syntax
+
+```sql
+SELECT column1, aggregate_function(column2)
+FROM table_name
+GROUP BY column1
+HAVING condition;
+```
+
+### 9.4 Simple HAVING Examples
+
+```sql
+-- Find categories with more than 2 products
+SELECT
+ category,
+ COUNT(*) AS product_count
+FROM product
+GROUP BY category
+HAVING COUNT(*) > 2;
+
+-- Find manufacturers with average price over $50
+SELECT
+ manufacturer,
+ AVG(price) AS avg_price
+FROM product
+GROUP BY manufacturer
+HAVING AVG(price) > 50;
+```
+
+### 9.5 HAVING with Multiple Conditions
+
+```sql
+-- Categories with more than 1 product AND average price > $30
+SELECT
+ category,
+ COUNT(*) AS product_count,
+ AVG(price) AS avg_price
+FROM product
+GROUP BY category
+HAVING COUNT(*) > 1 AND AVG(price) > 30;
+
+-- Manufacturers with at least 2 products OR total value > $100
+SELECT
+ manufacturer,
+ COUNT(*) AS product_count,
+ SUM(price) AS total_value
+FROM product
+GROUP BY manufacturer
+HAVING COUNT(*) >= 2 OR SUM(price) > 100;
+```
+
+### 9.6 Combining WHERE and HAVING
+
+```sql
+-- Find categories (excluding Household) with more than 1 product
+SELECT
+ category,
+ COUNT(*) AS product_count,
+ AVG(price) AS avg_price
+FROM product
+WHERE category != 'Household' -- Filter rows before grouping
+GROUP BY category
+HAVING COUNT(*) > 1; -- Filter groups after aggregation
+```
+
+**Execution Order:**
+1. WHERE filters individual rows
+2. GROUP BY groups the remaining rows
+3. Aggregate functions calculate values
+4. HAVING filters the groups
+5. ORDER BY sorts the final result
+
+### 9.7 HAVING with Range Conditions
+
+```sql
+-- Categories with average price between $30 and $100
+SELECT
+ category,
+ COUNT(*) AS product_count,
+ AVG(price) AS avg_price
+FROM product
+GROUP BY category
+HAVING AVG(price) BETWEEN 30 AND 100;
+```
+
+### 9.8 HAVING with IN Operator
+
+```sql
+-- Find manufacturers with specific product counts
+SELECT
+ manufacturer,
+ COUNT(*) AS product_count
+FROM product
+GROUP BY manufacturer
+HAVING COUNT(*) IN (2, 3, 4);
+```
+
+### 9.9 HAVING with Calculated Values
+
+```sql
+-- Categories where max price is more than 3x min price
+SELECT
+ category,
+ MIN(price) AS min_price,
+ MAX(price) AS max_price,
+ MAX(price) / MIN(price) AS price_ratio
+FROM product
+GROUP BY category
+HAVING MAX(price) / MIN(price) > 3;
+```
+
+### 9.10 HAVING with Joins
+
+```sql
+-- Countries with more than 2 products
+SELECT
+ c.country,
+ COUNT(p.pname) AS product_count
+FROM company c
+INNER JOIN product p ON c.cname = p.manufacturer
+GROUP BY c.country
+HAVING COUNT(p.pname) > 2;
+```
+
+### 9.11 HAVING with Subqueries
+
+```sql
+-- Categories with average price above overall average
+SELECT
+ category,
+ AVG(price) AS avg_price
+FROM product
+GROUP BY category
+HAVING AVG(price) > (SELECT AVG(price) FROM product);
+```
+
+### 9.12 Complete Example: WHERE, GROUP BY, HAVING, ORDER BY
+
+```sql
+-- Find high-value product categories
+SELECT
+ category,
+ COUNT(*) AS product_count,
+ MIN(price) AS min_price,
+ MAX(price) AS max_price,
+ AVG(price) AS avg_price,
+ SUM(price) AS total_value
+FROM product
+WHERE price > 20 -- Only products over $20
+GROUP BY category -- Group by category
+HAVING COUNT(*) >= 2 -- At least 2 products
+ AND AVG(price) > 30 -- Average over $30
+ORDER BY total_value DESC; -- Sort by total value
+```
+
+### 9.13 Common HAVING Mistakes
+
+**Mistake 1:** Using column alias in HAVING (not allowed in standard SQL)
+```sql
+-- INCORRECT in many databases
+-- SELECT category, COUNT(*) AS cnt
+-- FROM product
+-- GROUP BY category
+-- HAVING cnt > 2;
+
+-- CORRECT
+SELECT category, COUNT(*) AS cnt
+FROM product
+GROUP BY category
+HAVING COUNT(*) > 2;
+```
+
+**Mistake 2:** Filtering non-aggregated columns
+```sql
+-- Use WHERE for non-aggregated conditions
+-- CORRECT
+SELECT category, COUNT(*) AS count
+FROM product
+WHERE manufacturer = 'GizmoWorks'
+GROUP BY category;
+```
+
+### 9.14 HAVING Performance Tips
+
+- Use WHERE instead of HAVING when possible (filters before grouping = better performance)
+- Index columns used in GROUP BY
+- Be cautious with complex HAVING conditions on large datasets
+
+### 9.15 Practice Exercises
+
+**Exercise 1:** Find manufacturers that produce more than 2 different products.
+
+**Exercise 2:** Find categories where the total value of products exceeds $100.
+
+**Exercise 3:** Find manufacturers whose cheapest product costs more than $50.
+
+**Exercise 4:** List categories that have products from more than one manufacturer.
+
+**Exercise 5:** Find countries (using joins) where the average product price is above the global average.
+
+---
+
+## 10. Set Operation
+
+### 10.1 Introduction to Set Operations
+
+Set operations combine the results of two or more SELECT statements. They treat query results as mathematical sets, allowing for union, intersection, and difference operations.
+
+**Common Set Operations:**
+- `UNION`: Combines results from multiple queries, removing duplicates
+- `UNION ALL`: Combines results, keeping all duplicates
+- `INTERSECT`: Returns only rows that appear in both queries (not directly supported in MySQL)
+- `EXCEPT` (or `MINUS`): Returns rows from first query not in second (not directly supported in MySQL)
+
+### 10.2 UNION Operator
+
+UNION combines results from multiple SELECT statements and removes duplicate rows.
+
+```sql
+-- Products from Gadgets OR Photography categories
+SELECT pname, category FROM product WHERE category = 'Gadgets'
+UNION
+SELECT pname, category FROM product WHERE category = 'Photography';
+```
+
+**UNION Rules:**
+1. Each SELECT must have the same number of columns
+2. Columns must have compatible data types
+3. Column names from the first SELECT are used in the result
+
+### 10.3 UNION ALL Operator
+
+UNION ALL combines results but keeps all duplicate rows.
+
+```sql
+-- Combine products from two queries, keeping duplicates
+SELECT pname, category FROM product WHERE category = 'Gadgets'
+UNION ALL
+SELECT pname, category FROM product WHERE price > 50;
+```
+
+**When to use UNION ALL:**
+- When you know there are no duplicates
+- When you want to keep duplicates
+- Better performance (no duplicate removal)
+
+### 10.4 UNION vs UNION ALL Performance
+
+```sql
+-- UNION (slower - removes duplicates)
+SELECT manufacturer FROM product WHERE category = 'Gadgets'
+UNION
+SELECT manufacturer FROM product WHERE category = 'Photography';
+
+-- UNION ALL (faster - keeps duplicates)
+SELECT manufacturer FROM product WHERE category = 'Gadgets'
+UNION ALL
+SELECT manufacturer FROM product WHERE category = 'Photography';
+```
+
+### 10.5 UNION with Different Tables
+
+```sql
+-- Combine product names and company names into one list
+SELECT pname AS name, 'Product' AS type FROM product
+UNION
+SELECT cname AS name, 'Company' AS type FROM company
+ORDER BY name;
+```
+
+### 10.6 UNION with Aggregates
+
+```sql
+-- Combine statistics from different queries
+SELECT 'Gadgets' AS category, COUNT(*) AS count, AVG(price) AS avg_price
+FROM product WHERE category = 'Gadgets'
+UNION ALL
+SELECT 'Photography', COUNT(*), AVG(price)
+FROM product WHERE category = 'Photography'
+UNION ALL
+SELECT 'All Categories', COUNT(*), AVG(price)
+FROM product;
+```
+
+### 10.7 INTERSECT Operation (MySQL Alternative)
+
+MySQL doesn't have native INTERSECT, but you can achieve it using joins or subqueries.
+
+```sql
+-- Find products that are both in Gadgets and have price > 25
+-- Method 1: Using INNER JOIN
+SELECT DISTINCT p1.pname
+FROM product p1
+INNER JOIN product p2 ON p1.pname = p2.pname
+WHERE p1.category = 'Gadgets' AND p2.price > 25;
+
+-- Method 2: Using IN
+SELECT pname FROM product WHERE category = 'Gadgets'
+AND pname IN (SELECT pname FROM product WHERE price > 25);
+
+-- Method 3: Using EXISTS
+SELECT p1.pname FROM product p1
+WHERE p1.category = 'Gadgets'
+AND EXISTS (SELECT 1 FROM product p2 WHERE p2.pname = p1.pname AND p2.price > 25);
+```
+
+### 10.8 EXCEPT/MINUS Operation (MySQL Alternative)
+
+MySQL doesn't have native EXCEPT, but you can use NOT IN or NOT EXISTS.
+
+```sql
+-- Find products in Gadgets that are NOT priced over $40
+-- Method 1: Using NOT IN
+SELECT pname FROM product WHERE category = 'Gadgets'
+AND pname NOT IN (SELECT pname FROM product WHERE price > 40);
+
+-- Method 2: Using NOT EXISTS
+SELECT p1.pname FROM product p1
+WHERE p1.category = 'Gadgets'
+AND NOT EXISTS (
+ SELECT 1 FROM product p2
+ WHERE p2.pname = p1.pname AND p2.price > 40
+);
+
+-- Method 3: Using LEFT JOIN with NULL check
+SELECT p1.pname
+FROM product p1
+LEFT JOIN (SELECT pname FROM product WHERE price > 40) p2
+ ON p1.pname = p2.pname
+WHERE p1.category = 'Gadgets' AND p2.pname IS NULL;
+```
+
+### 10.9 Complex UNION Examples
+
+```sql
+-- Comprehensive product and company report
+SELECT
+ 'Product' AS type,
+ pname AS name,
+ category AS detail,
+ price AS value
+FROM product
+UNION ALL
+SELECT
+ 'Company' AS type,
+ cname AS name,
+ country AS detail,
+ NULL AS value
+FROM company
+ORDER BY type, name;
+```
+
+### 10.10 UNION with WHERE and ORDER BY
+
+```sql
+-- Expensive products from multiple categories
+(SELECT pname, price, category FROM product
+ WHERE category = 'Gadgets' AND price > 30)
+UNION
+(SELECT pname, price, category FROM product
+ WHERE category = 'Photography' AND price > 100)
+ORDER BY price DESC;
+```
+
+**Note:** When using ORDER BY with UNION, place it after the last SELECT and it applies to the entire result.
+
+### 10.11 UNION with LIMIT
+
+```sql
+-- Get top 2 from each category
+(SELECT pname, price, category FROM product
+ WHERE category = 'Gadgets'
+ ORDER BY price DESC LIMIT 2)
+UNION ALL
+(SELECT pname, price, category FROM product
+ WHERE category = 'Photography'
+ ORDER BY price DESC LIMIT 2)
+ORDER BY price DESC;
+```
+
+### 10.12 Practical Set Operation Examples
+
+#### Example 1: Customer Activity Report
+```sql
+-- Combine new and returning customers
+SELECT customer_id, 'New' AS status FROM orders
+WHERE order_date >= '2024-01-01'
+AND customer_id NOT IN (SELECT customer_id FROM orders WHERE order_date < '2024-01-01')
+UNION
+SELECT customer_id, 'Returning' AS status FROM orders
+WHERE order_date >= '2024-01-01'
+AND customer_id IN (SELECT customer_id FROM orders WHERE order_date < '2024-01-01');
+```
+
+#### Example 2: Product Inventory Report
+```sql
+-- Combine high stock, low stock, and out of stock products
+SELECT product_id, name, 'High Stock' AS status
+FROM inventory WHERE quantity > 100
+UNION ALL
+SELECT product_id, name, 'Low Stock' AS status
+FROM inventory WHERE quantity BETWEEN 1 AND 100
+UNION ALL
+SELECT product_id, name, 'Out of Stock' AS status
+FROM inventory WHERE quantity = 0
+ORDER BY status, name;
+```
+
+### 10.13 Set Operations with Joins
+
+```sql
+-- Products from US companies UNION products from Japanese companies
+SELECT p.pname, p.category, c.country
+FROM product p
+INNER JOIN company c ON p.manufacturer = c.cname
+WHERE c.country = 'USA'
+UNION
+SELECT p.pname, p.category, c.country
+FROM product p
+INNER JOIN company c ON p.manufacturer = c.cname
+WHERE c.country = 'Japan'
+ORDER BY country, pname;
+```
+
+### 10.14 Common Set Operation Mistakes
+
+**Mistake 1:** Different number of columns
+```sql
+-- INCORRECT
+-- SELECT pname FROM product
+-- UNION
+-- SELECT cname, city FROM company; -- Different column count!
+```
+
+**Mistake 2:** Incompatible data types
+```sql
+-- INCORRECT
+-- SELECT pname FROM product
+-- UNION
+-- SELECT price FROM product; -- VARCHAR and DECIMAL don't match well
+```
+
+**Mistake 3:** Using ORDER BY in individual SELECTs
+```sql
+-- INCORRECT
+-- SELECT pname FROM product ORDER BY pname
+-- UNION
+-- SELECT cname FROM company ORDER BY cname;
+
+-- CORRECT
+SELECT pname AS name FROM product
+UNION
+SELECT cname AS name FROM company
+ORDER BY name;
+```
+
+### 10.15 Set Operations Performance Tips
+
+1. Use UNION ALL instead of UNION when duplicates don't matter (faster)
+2. Add WHERE clauses to filter before UNION (reduces rows to process)
+3. Ensure columns used in ORDER BY are indexed
+4. Use parentheses to control execution order in complex unions
+5. Consider materialized views for frequently used union queries
+
+### 10.16 Practice Exercises
+
+**Exercise 1:** Create a UNION query that lists all unique cities from both the company and customer tables.
+
+**Exercise 2:** Find products that are either in the 'Gadgets' category OR priced above $100, removing duplicates.
+
+**Exercise 3:** Create a report combining products with low stock and products that haven't sold in 30 days.
+
+**Exercise 4:** Simulate an INTERSECT operation to find products that are both in 'Photography' category AND made by Japanese companies.
+
+**Exercise 5:** Simulate an EXCEPT operation to find products in 'Gadgets' category that have never been ordered.
+
+---
+
+## 📚 Summary and Next Steps
+
+### What You've Learned
+
+In this comprehensive guide, you've mastered:
+
+1. **Create Tables**: Database and table creation with proper data types and constraints
+2. **Single Table Query**: SELECT statements with filtering using WHERE clause
+3. **DISTINCT**: Removing duplicates and finding unique values
+4. **ORDER BY**: Sorting results in ascending or descending order
+5. **Foreign Key**: Establishing referential integrity and table relationships
+6. **Multi Table**: Joining tables using INNER JOIN, LEFT JOIN, RIGHT JOIN
+7. **Aggregate Function**: Using COUNT, SUM, AVG, MIN, MAX for data analysis
+8. **GROUP BY**: Grouping data for summary statistics
+9. **HAVING**: Filtering grouped results
+10. **Set Operation**: Combining queries with UNION and UNION ALL
+
+### Recommended Next Steps
+
+1. **Practice, Practice, Practice**: Work through all exercises in each section
+2. **Real-World Projects**: Apply these concepts to your own database projects
+3. **Advanced Topics**: Explore subqueries, window functions, stored procedures
+4. **Performance Optimization**: Learn about indexes, query optimization, and execution plans
+5. **Database Design**: Study normalization and entity-relationship modeling
+
+### Additional Resources
+
+- [MySQL Official Documentation](https://dev.mysql.com/doc/)
+- [SQL Tutorial - W3Schools](https://www.w3schools.com/sql/)
+- [SQLZoo Interactive Tutorial](https://sqlzoo.net/)
+- [LeetCode Database Problems](https://leetcode.com/problemset/database/)
+
+### Practice Database
+
+All examples in this guide use the `sql_fundamentals` database. You can recreate it by running all the CREATE TABLE and INSERT statements in order.
+
+---
+
+## 🎓 Final Practice Project
+
+Create a complete database system for a bookstore with the following requirements:
+
+1. **Tables**: Books, Authors, Publishers, Customers, Orders, OrderDetails
+2. **Relationships**: Implement foreign keys between all related tables
+3. **Queries**: Write queries using all concepts learned:
+ - List all books with their authors and publishers (multi-table)
+ - Find the top 5 best-selling books (aggregate + order by)
+ - Calculate total sales by genre (group by + having)
+ - Find customers who haven't ordered in 6 months (set operations)
+ - Get unique genres available (distinct)
+
+This project will reinforce all concepts covered in this guide.
+
+---
+
+**Good luck with your SQL journey! 🚀**
From 14b6f7f2150b6be272a73a0c645ea1641aba1aa3 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 11 Feb 2026 03:30:56 +0000
Subject: [PATCH 03/10] Add HTML version and update documentation to reference
new reorganized lab
Co-authored-by: khalefa-ow <88914125+khalefa-ow@users.noreply.github.com>
---
LAB_INDEX.md | 35 +++
Readme.md | 6 +
.../Lab_Reorganized_SQL_Fundamentals.html | 235 ++++++++++++++++++
3 files changed, 276 insertions(+)
create mode 100644 labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html
diff --git a/LAB_INDEX.md b/LAB_INDEX.md
index a9fce67..2842c8a 100644
--- a/LAB_INDEX.md
+++ b/LAB_INDEX.md
@@ -10,6 +10,41 @@
---
+## 🆕 NEW: Reorganized Comprehensive Lab
+
+### SQL Fundamentals - Complete Reorganized Guide ⭐ NEW
+**Topics**: All fundamental SQL concepts in logical order
+**Duration**: 8-12 hours (self-paced)
+**Prerequisites**: None - Perfect for beginners!
+**Link**: [Reorganized SQL Fundamentals Lab](Lab_Reorganized_SQL_Fundamentals.md) | [HTML Version](labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html)
+
+**What You'll Learn:**
+This comprehensive guide consolidates all fundamental SQL concepts into a single, logically ordered resource:
+
+1. **Create Tables** - Database and table creation with data types and constraints
+2. **Single Table Query** - SELECT statements with WHERE, operators, and pattern matching
+3. **DISTINCT** - Removing duplicates and finding unique values
+4. **ORDER BY** - Sorting data in ascending/descending order
+5. **Foreign Key** - Referential integrity and table relationships
+6. **Multi Table** - JOINs (INNER, LEFT, RIGHT) and multi-table queries
+7. **Aggregate Function** - COUNT, SUM, AVG, MAX, MIN for data analysis
+8. **GROUP BY** - Grouping data for summary statistics
+9. **HAVING** - Filtering grouped results
+10. **Set Operation** - UNION, UNION ALL, and set operations
+
+**Key Features:**
+- ✅ Progressive learning structure - each topic builds on previous ones
+- ✅ Comprehensive examples with real-world scenarios
+- ✅ Practice exercises for every section
+- ✅ Common mistakes and best practices
+- ✅ Performance tips and optimization suggestions
+- ✅ Complete code examples ready to run
+
+**Why This Lab?**
+This reorganized lab presents SQL fundamentals in the most logical learning order, making it easier for beginners to grasp concepts progressively while providing a comprehensive reference for all skill levels.
+
+---
+
## 📚 All Labs by Category
### 🟢 Beginner Level (Start Here!)
diff --git a/Readme.md b/Readme.md
index d8f589a..60bc806 100644
--- a/Readme.md
+++ b/Readme.md
@@ -27,6 +27,12 @@ By completing these labs, students will:
## 📚 Lab Structure
+### 🆕 Reorganized Comprehensive Lab
+
+| Lab | Topic | Description | Resource |
+|-----|-------|-------------|----------|
+| **NEW** | **SQL Fundamentals - Complete Guide** | **Comprehensive reorganized lab covering all SQL basics in logical order: Create Tables, Single Table Query, DISTINCT, ORDER BY, Foreign Key, Multi Table, Aggregate Functions, GROUP BY, HAVING, Set Operations** | **[Reorganized Lab](Lab_Reorganized_SQL_Fundamentals.md)** ⭐ **NEW** |
+
### Foundational Labs (SQL Basics)
| Lab | Topic | Description | Resource |
diff --git a/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html b/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html
new file mode 100644
index 0000000..b645b2d
--- /dev/null
+++ b/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html
@@ -0,0 +1,235 @@
+
+
+
This comprehensive guide covers fundamental SQL concepts in a logical progression, from basic table creation to advanced set operations. Each section builds upon the previous one, providing a structured learning path for database management.
+
+
Prerequisites:
+
+
MySQL or MariaDB server installed and running
+
Basic understanding of relational database concepts
+
Access to a SQL client (command line, MySQL Workbench, etc.)
+
+
+
+
+
1. Create Tables
+
+
1.1 Introduction to Database and Table Creation
+
A database is a container that holds related tables. Before creating tables, you must first create and select a database.
+
+
1.2 Create a Database
+
+
-- Create a new database
+CREATE DATABASE sql_fundamentals;
+
+-- Switch to the database
+USE sql_fundamentals;
+
+
+
+
+
Note: Database names are case-sensitive on some systems. Use lowercase for consistency.
+
+
1.3 Understanding Data Types
+
Common MySQL data types:
+
+
INT: Integer numbers
+
DECIMAL(p,s): Fixed-point numbers (e.g., DECIMAL(10,2) for prices)
+
VARCHAR(n): Variable-length strings up to n characters
This HTML page provides a preview. For the complete, detailed guide covering all 10 topics with comprehensive examples, exercises, and explanations, please view:
+
+
+
+
+
From 35c3889c203a27be860526d940496256f0a6c682 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 11 Feb 2026 03:31:53 +0000
Subject: [PATCH 04/10] Add comprehensive summary document for reorganized lab
Co-authored-by: khalefa-ow <88914125+khalefa-ow@users.noreply.github.com>
---
REORGANIZED_LAB_SUMMARY.md | 151 +++++++++++++++++++++++++++++++++++++
1 file changed, 151 insertions(+)
create mode 100644 REORGANIZED_LAB_SUMMARY.md
diff --git a/REORGANIZED_LAB_SUMMARY.md b/REORGANIZED_LAB_SUMMARY.md
new file mode 100644
index 0000000..839c0ff
--- /dev/null
+++ b/REORGANIZED_LAB_SUMMARY.md
@@ -0,0 +1,151 @@
+# Reorganized SQL Fundamentals Lab - Summary
+
+## 🎯 Purpose
+
+This document summarizes the newly created reorganized SQL fundamentals lab that presents all basic SQL concepts in a logical, progressive learning order.
+
+## 📋 What Was Created
+
+### 1. Main Lab Document
+**File:** `Lab_Reorganized_SQL_Fundamentals.md`
+**Size:** ~49 KB
+**Lines:** 1,852 lines
+**Format:** Markdown
+
+A comprehensive guide covering 10 fundamental SQL topics in the following order:
+
+1. **Create Tables** - Database and table creation with constraints
+2. **Single Table Query** - SELECT with WHERE and filtering
+3. **DISTINCT** - Removing duplicates and unique values
+4. **ORDER BY** - Sorting results
+5. **Foreign Key** - Referential integrity and relationships
+6. **Multi Table** - JOINs and multi-table queries
+7. **Aggregate Function** - COUNT, SUM, AVG, MAX, MIN
+8. **GROUP BY** - Grouping data for analysis
+9. **HAVING** - Filtering grouped results
+10. **Set Operation** - UNION and set operations
+
+### 2. HTML Version
+**File:** `labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html`
+**Size:** ~10 KB
+**Format:** HTML
+
+A web-friendly version with:
+- Consistent styling matching existing labs
+- Code block copy functionality
+- Navigation links
+- References to the full markdown guide
+
+### 3. Documentation Updates
+**Updated Files:**
+- `Readme.md` - Added new lab section at top of Lab Structure
+- `LAB_INDEX.md` - Added comprehensive entry for the new lab
+
+## 📚 Content Structure
+
+Each of the 10 sections includes:
+
+### Learning Materials
+- **Introduction** to the concept
+- **Syntax explanations** with detailed comments
+- **Multiple examples** progressing from simple to complex
+- **Real-world scenarios** and use cases
+- **Visual output examples** showing expected results
+
+### Practice Components
+- **Practice exercises** at the end of each section (3-5 exercises per topic)
+- **Common mistakes** to avoid
+- **Best practices** and tips
+- **Performance considerations** where relevant
+
+### Code Examples
+- **Complete, runnable SQL code** for all examples
+- **Progressive complexity** building on previous sections
+- **Sample data** included for hands-on practice
+- **Comments explaining** each line of complex queries
+
+## 🎓 Learning Path
+
+The lab is designed for:
+
+### Beginners
+- Start from Section 1 and work through sequentially
+- No prior SQL knowledge required
+- Each section builds on previous concepts
+- Estimated time: 8-12 hours (self-paced)
+
+### Intermediate Users
+- Use as a comprehensive reference
+- Jump to specific sections as needed
+- Review best practices and advanced tips
+- Refresh specific concepts
+
+## 🔗 How to Access
+
+### Markdown Version (Full Content)
+- **Path:** `/Lab_Reorganized_SQL_Fundamentals.md`
+- **Best for:** Reading, searching, printing, offline use
+- **Contains:** All content, exercises, examples
+
+### HTML Version (Web View)
+- **Path:** `/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html`
+- **Best for:** Web browsing, quick reference
+- **Contains:** Overview and links to full content
+
+### From Main Documentation
+- **Readme.md:** Listed in "Reorganized Comprehensive Lab" section
+- **LAB_INDEX.md:** Detailed entry at the top with full description
+
+## ✅ Verification Checklist
+
+- [x] Markdown file created with all 10 topics
+- [x] HTML version created and styled
+- [x] README.md updated with new lab reference
+- [x] LAB_INDEX.md updated with comprehensive description
+- [x] All internal links verified
+- [x] Code examples tested for syntax
+- [x] Content organized in requested order
+- [x] Each section has practice exercises
+- [x] Progressive learning structure implemented
+- [x] Files committed and pushed to branch
+
+## 📊 Statistics
+
+- **Total Sections:** 10 main topics
+- **Total Subsections:** 142 headings
+- **Code Examples:** 100+ SQL queries
+- **Practice Exercises:** 40+ exercises across all sections
+- **File Size:** ~49 KB (markdown), ~10 KB (HTML)
+- **Estimated Reading Time:** 3-4 hours
+- **Estimated Practice Time:** 8-12 hours
+
+## 🎯 Key Features
+
+1. **Logical Progression:** Topics build naturally from basic to advanced
+2. **Self-Contained:** All necessary concepts explained within the document
+3. **Practical Focus:** Real-world examples and scenarios throughout
+4. **Exercise-Rich:** Multiple practice opportunities per section
+5. **Best Practices:** Common mistakes and optimization tips included
+6. **Reference-Ready:** Easy to search and navigate for quick lookups
+
+## 🚀 Next Steps
+
+Students can:
+1. Work through the entire guide sequentially
+2. Complete all practice exercises
+3. Apply concepts to their own database projects
+4. Progress to advanced labs (Views, Triggers, Transactions)
+5. Explore programming integration labs (Python, Java)
+
+Instructors can:
+1. Use as primary course material for SQL fundamentals
+2. Assign specific sections as homework
+3. Reference for lecture preparation
+4. Create assessments based on exercises
+5. Adapt and extend for specific course needs
+
+---
+
+**Created:** February 11, 2026
+**Branch:** copilot/create-tables-and-queries
+**Status:** Complete and ready for use
From d508ec468e7bc91f3fe81d04f0eb99f3d1055e72 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 11 Feb 2026 04:10:57 +0000
Subject: [PATCH 05/10] Add simplified SQL Quick Start Guide with streamlined
content
Co-authored-by: khalefa-ow <88914125+khalefa-ow@users.noreply.github.com>
---
LAB_INDEX.md | 41 +-
Readme.md | 5 +-
SQL_Quick_Start_Guide.md | 460 +++++++++++++++++
labs/html_labs/SQL_Quick_Start_Guide.html | 585 ++++++++++++++++++++++
4 files changed, 1085 insertions(+), 6 deletions(-)
create mode 100644 SQL_Quick_Start_Guide.md
create mode 100644 labs/html_labs/SQL_Quick_Start_Guide.html
diff --git a/LAB_INDEX.md b/LAB_INDEX.md
index 2842c8a..9b5a6d3 100644
--- a/LAB_INDEX.md
+++ b/LAB_INDEX.md
@@ -10,12 +10,43 @@
---
-## 🆕 NEW: Reorganized Comprehensive Lab
+## 🆕 NEW: Quick Start & Comprehensive SQL Labs
-### SQL Fundamentals - Complete Reorganized Guide ⭐ NEW
+### ⚡ SQL Quick Start Guide ⭐ NEW
+**Topics**: All fundamental SQL concepts in streamlined format
+**Duration**: 3-4 hours (fast-track)
+**Prerequisites**: None - Perfect for quick learners!
+**Link**: [SQL Quick Start Guide](SQL_Quick_Start_Guide.md) | [HTML Version](labs/html_labs/SQL_Quick_Start_Guide.html)
+
+**What You'll Learn:**
+A streamlined, beginner-friendly guide that gets you coding fast! Each section is concise with practical examples:
+
+1. **Create Tables** - Quick setup with essential syntax
+2. **Single Table Query** - Core SELECT queries and filtering
+3. **DISTINCT** - Remove duplicates (1-2 examples)
+4. **ORDER BY** - Sort results efficiently
+5. **Foreign Key** - Link tables with integrity
+6. **Multi Table** - Focus on INNER JOIN
+7. **Aggregate Functions** - COUNT, SUM, AVG, MAX, MIN
+8. **GROUP BY** - Simple grouping examples
+9. **HAVING** - Filter grouped data
+10. **Set Operations** - Combine results with UNION
+
+**Why This Guide?**
+- ✅ **Fast**: Learn SQL in 3-4 hours
+- ✅ **Practical**: Code examples you can run immediately
+- ✅ **Simple**: No information overload - just what you need
+- ✅ **Hands-on**: Practice exercises after each topic
+- ✅ **Reference**: Quick syntax reference included
+
+**Best for:** Complete beginners, fast learners, developers who prefer learning by doing, quick reference needs.
+
+---
+
+### 📚 SQL Fundamentals - Complete Reorganized Guide
**Topics**: All fundamental SQL concepts in logical order
**Duration**: 8-12 hours (self-paced)
-**Prerequisites**: None - Perfect for beginners!
+**Prerequisites**: None - Comprehensive for all levels!
**Link**: [Reorganized SQL Fundamentals Lab](Lab_Reorganized_SQL_Fundamentals.md) | [HTML Version](labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html)
**What You'll Learn:**
@@ -35,7 +66,7 @@ This comprehensive guide consolidates all fundamental SQL concepts into a single
**Key Features:**
- ✅ Progressive learning structure - each topic builds on previous ones
- ✅ Comprehensive examples with real-world scenarios
-- ✅ Practice exercises for every section
+- ✅ 40+ practice exercises for every section
- ✅ Common mistakes and best practices
- ✅ Performance tips and optimization suggestions
- ✅ Complete code examples ready to run
@@ -43,6 +74,8 @@ This comprehensive guide consolidates all fundamental SQL concepts into a single
**Why This Lab?**
This reorganized lab presents SQL fundamentals in the most logical learning order, making it easier for beginners to grasp concepts progressively while providing a comprehensive reference for all skill levels.
+**Best for:** Thorough learners, students preparing for exams, those who want deep understanding, instructors teaching SQL.
+
---
## 📚 All Labs by Category
diff --git a/Readme.md b/Readme.md
index 60bc806..cb220f9 100644
--- a/Readme.md
+++ b/Readme.md
@@ -27,11 +27,12 @@ By completing these labs, students will:
## 📚 Lab Structure
-### 🆕 Reorganized Comprehensive Lab
+### 🆕 Quick Start & Comprehensive Labs
| Lab | Topic | Description | Resource |
|-----|-------|-------------|----------|
-| **NEW** | **SQL Fundamentals - Complete Guide** | **Comprehensive reorganized lab covering all SQL basics in logical order: Create Tables, Single Table Query, DISTINCT, ORDER BY, Foreign Key, Multi Table, Aggregate Functions, GROUP BY, HAVING, Set Operations** | **[Reorganized Lab](Lab_Reorganized_SQL_Fundamentals.md)** ⭐ **NEW** |
+| **QUICK START** | **SQL Quick Start Guide** | **⚡ Streamlined, beginner-friendly guide (3-4 hrs). Perfect for fast learners who want practical examples without extensive theory. Covers all 10 SQL fundamentals in a concise, easy-to-follow format.** | **[Quick Start Guide](SQL_Quick_Start_Guide.md)** ⭐ **NEW** |
+| **COMPREHENSIVE** | **SQL Fundamentals - Complete Guide** | **📚 In-depth comprehensive lab (8-12 hrs). Detailed explanations, multiple examples per concept, best practices, and 40+ exercises. Ideal for thorough learning.** | **[Complete Lab](Lab_Reorganized_SQL_Fundamentals.md)** ⭐ |
### Foundational Labs (SQL Basics)
diff --git a/SQL_Quick_Start_Guide.md b/SQL_Quick_Start_Guide.md
new file mode 100644
index 0000000..d1c48e6
--- /dev/null
+++ b/SQL_Quick_Start_Guide.md
@@ -0,0 +1,460 @@
+# SQL Quick Start Guide
+
+> **A straightforward, beginner-friendly introduction to SQL fundamentals**
+
+## 🎯 What You'll Learn
+
+This guide covers 10 essential SQL topics in order. Each section is concise with practical examples you can run immediately.
+
+**Estimated Time:** 3-4 hours
+
+**Prerequisites:** MySQL or MariaDB installed
+
+---
+
+## 📋 Table of Contents
+
+1. [Create Tables](#1-create-tables)
+2. [Single Table Query](#2-single-table-query)
+3. [DISTINCT](#3-distinct)
+4. [ORDER BY](#4-order-by)
+5. [Foreign Key](#5-foreign-key)
+6. [Multi Table](#6-multi-table)
+7. [Aggregate Functions](#7-aggregate-functions)
+8. [GROUP BY](#8-group-by)
+9. [HAVING](#9-having)
+10. [Set Operations](#10-set-operations)
+
+---
+
+## 1. Create Tables
+
+### Setup Database
+
+```sql
+CREATE DATABASE store;
+USE store;
+```
+
+### Create Your First Table
+
+```sql
+CREATE TABLE products (
+ id INT PRIMARY KEY,
+ name VARCHAR(50),
+ price DECIMAL(10,2),
+ category VARCHAR(30)
+);
+```
+
+**Key Points:**
+- `PRIMARY KEY`: Unique identifier
+- `VARCHAR(n)`: Text up to n characters
+- `DECIMAL(10,2)`: Numbers with 2 decimal places
+
+### Add Data
+
+```sql
+INSERT INTO products VALUES
+(1, 'Laptop', 999.99, 'Electronics'),
+(2, 'Mouse', 25.50, 'Electronics'),
+(3, 'Desk', 299.99, 'Furniture'),
+(4, 'Chair', 199.99, 'Furniture'),
+(5, 'Monitor', 349.99, 'Electronics');
+```
+
+### ✏️ Practice
+Create a `customers` table with: id, name, email, city.
+
+---
+
+## 2. Single Table Query
+
+### Select All Data
+
+```sql
+SELECT * FROM products;
+```
+
+### Select Specific Columns
+
+```sql
+SELECT name, price FROM products;
+```
+
+### Filter with WHERE
+
+```sql
+-- Products under $300
+SELECT * FROM products WHERE price < 300;
+
+-- Products in Electronics category
+SELECT * FROM products WHERE category = 'Electronics';
+
+-- Multiple conditions with AND
+SELECT * FROM products
+WHERE category = 'Electronics' AND price < 500;
+
+-- Multiple conditions with OR
+SELECT * FROM products
+WHERE category = 'Electronics' OR category = 'Furniture';
+```
+
+### Pattern Matching with LIKE
+
+```sql
+-- Products starting with 'M'
+SELECT * FROM products WHERE name LIKE 'M%';
+
+-- Products containing 'top'
+SELECT * FROM products WHERE name LIKE '%top%';
+```
+
+### ✏️ Practice
+Find all furniture items priced between $100 and $300.
+
+---
+
+## 3. DISTINCT
+
+### Get Unique Values
+
+```sql
+-- List all unique categories
+SELECT DISTINCT category FROM products;
+
+-- Count unique categories
+SELECT COUNT(DISTINCT category) FROM products;
+```
+
+**When to use:** Eliminate duplicate rows from results.
+
+### ✏️ Practice
+Find all unique price values in the products table.
+
+---
+
+## 4. ORDER BY
+
+### Sort Results
+
+```sql
+-- Sort by price (ascending)
+SELECT * FROM products ORDER BY price;
+
+-- Sort by price (descending)
+SELECT * FROM products ORDER BY price DESC;
+
+-- Sort by multiple columns
+SELECT * FROM products ORDER BY category, price DESC;
+```
+
+**Tips:**
+- `ASC` = ascending (default)
+- `DESC` = descending
+- Can sort by multiple columns
+
+### ✏️ Practice
+List all products sorted by category (A-Z) and then by price (high to low).
+
+---
+
+## 5. Foreign Key
+
+### Why Foreign Keys?
+Foreign keys link tables together and ensure data integrity.
+
+### Create Related Tables
+
+```sql
+-- Suppliers table (parent)
+CREATE TABLE suppliers (
+ id INT PRIMARY KEY,
+ name VARCHAR(50),
+ country VARCHAR(30)
+);
+
+-- Products with foreign key (child)
+CREATE TABLE products_fk (
+ id INT PRIMARY KEY,
+ name VARCHAR(50),
+ price DECIMAL(10,2),
+ supplier_id INT,
+ FOREIGN KEY (supplier_id) REFERENCES suppliers(id)
+);
+```
+
+### Add Data
+
+```sql
+-- Add suppliers first
+INSERT INTO suppliers VALUES
+(1, 'TechCorp', 'USA'),
+(2, 'FurnitureCo', 'Canada');
+
+-- Add products that reference suppliers
+INSERT INTO products_fk VALUES
+(1, 'Laptop', 999.99, 1),
+(2, 'Desk', 299.99, 2);
+```
+
+**Important:** You must insert parent records (suppliers) before child records (products).
+
+### ✏️ Practice
+Try inserting a product with a supplier_id that doesn't exist. What happens?
+
+---
+
+## 6. Multi Table
+
+### JOIN Tables
+
+```sql
+-- Show products with their supplier information
+SELECT
+ p.name AS product_name,
+ p.price,
+ s.name AS supplier_name,
+ s.country
+FROM products_fk p
+INNER JOIN suppliers s ON p.supplier_id = s.id;
+```
+
+### Types of JOINs
+
+**INNER JOIN** - Only matching rows
+```sql
+SELECT p.name, s.name
+FROM products_fk p
+INNER JOIN suppliers s ON p.supplier_id = s.id;
+```
+
+**LEFT JOIN** - All from left table, matching from right
+```sql
+SELECT p.name, s.name
+FROM products_fk p
+LEFT JOIN suppliers s ON p.supplier_id = s.id;
+```
+
+**Tip:** Start with INNER JOIN. It's the most common.
+
+### ✏️ Practice
+Join customers and orders tables (create these tables first).
+
+---
+
+## 7. Aggregate Functions
+
+### Common Functions
+
+```sql
+-- Count all products
+SELECT COUNT(*) FROM products;
+
+-- Sum of all prices
+SELECT SUM(price) FROM products;
+
+-- Average price
+SELECT AVG(price) FROM products;
+
+-- Highest price
+SELECT MAX(price) FROM products;
+
+-- Lowest price
+SELECT MIN(price) FROM products;
+```
+
+### All in One Query
+
+```sql
+SELECT
+ COUNT(*) AS total_products,
+ SUM(price) AS total_value,
+ AVG(price) AS average_price,
+ MAX(price) AS highest_price,
+ MIN(price) AS lowest_price
+FROM products;
+```
+
+### ✏️ Practice
+Calculate the total value of all electronics products.
+
+---
+
+## 8. GROUP BY
+
+### Group Data
+
+```sql
+-- Count products by category
+SELECT category, COUNT(*) AS count
+FROM products
+GROUP BY category;
+
+-- Average price by category
+SELECT category, AVG(price) AS avg_price
+FROM products
+GROUP BY category;
+
+-- Multiple aggregations
+SELECT
+ category,
+ COUNT(*) AS count,
+ AVG(price) AS avg_price,
+ MAX(price) AS max_price
+FROM products
+GROUP BY category;
+```
+
+**Rule:** Every column in SELECT must be either in GROUP BY or an aggregate function.
+
+### ✏️ Practice
+Find the total value of products in each category.
+
+---
+
+## 9. HAVING
+
+### Filter Grouped Results
+
+**WHERE** filters rows before grouping
+**HAVING** filters groups after aggregation
+
+```sql
+-- Categories with more than 2 products
+SELECT category, COUNT(*) AS count
+FROM products
+GROUP BY category
+HAVING COUNT(*) > 2;
+
+-- Categories with average price over $300
+SELECT category, AVG(price) AS avg_price
+FROM products
+GROUP BY category
+HAVING AVG(price) > 300;
+```
+
+### Combined Example
+
+```sql
+-- Electronics products, grouped by category,
+-- only show groups with avg price > $100
+SELECT category, AVG(price) AS avg_price
+FROM products
+WHERE category = 'Electronics'
+GROUP BY category
+HAVING AVG(price) > 100;
+```
+
+### ✏️ Practice
+Find categories that have at least 1 product and average price under $250.
+
+---
+
+## 10. Set Operations
+
+### UNION - Combine Results
+
+```sql
+-- Combine two queries
+SELECT name FROM products WHERE category = 'Electronics'
+UNION
+SELECT name FROM products WHERE price > 500;
+```
+
+**UNION** removes duplicates
+**UNION ALL** keeps duplicates
+
+```sql
+-- Keep all rows including duplicates
+SELECT category FROM products WHERE price < 300
+UNION ALL
+SELECT category FROM products WHERE price > 200;
+```
+
+**Rules:**
+- Same number of columns in each SELECT
+- Compatible data types
+- Column names from first SELECT are used
+
+### ✏️ Practice
+Combine a list of product names under $100 with product names in the Furniture category.
+
+---
+
+## 🎓 Quick Reference Summary
+
+### Create & Insert
+```sql
+CREATE TABLE table_name (column datatype constraints);
+INSERT INTO table_name VALUES (val1, val2, ...);
+```
+
+### Query
+```sql
+SELECT columns FROM table WHERE condition ORDER BY column;
+```
+
+### Join
+```sql
+SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id;
+```
+
+### Aggregate & Group
+```sql
+SELECT column, COUNT(*), AVG(column2)
+FROM table
+WHERE condition
+GROUP BY column
+HAVING COUNT(*) > value;
+```
+
+### Combine
+```sql
+SELECT columns FROM table1
+UNION
+SELECT columns FROM table2;
+```
+
+---
+
+## 📚 Next Steps
+
+**You've learned:**
+✅ Creating tables and inserting data
+✅ Querying and filtering data
+✅ Sorting and removing duplicates
+✅ Linking tables with foreign keys
+✅ Joining multiple tables
+✅ Calculating statistics
+✅ Grouping and filtering groups
+✅ Combining query results
+
+**Continue learning:**
+- Views and Virtual Tables
+- Subqueries and Nested Queries
+- Indexes and Performance
+- Transactions and ACID
+- Stored Procedures and Triggers
+
+---
+
+## 💡 Tips for Success
+
+1. **Practice by typing** - Don't copy/paste. Type the SQL yourself.
+2. **Use real data** - Create your own tables with data you care about.
+3. **Read error messages** - They tell you exactly what's wrong.
+4. **Start simple** - Master SELECT before complex JOINs.
+5. **Draw your tables** - Sketch table relationships on paper.
+
+---
+
+## 🔗 Resources
+
+- [MySQL Documentation](https://dev.mysql.com/doc/)
+- [SQL Tutorial - W3Schools](https://www.w3schools.com/sql/)
+- [SQLZoo Interactive Tutorial](https://sqlzoo.net/)
+
+---
+
+**Ready to code? Start with Section 1 and work your way through!** 🚀
diff --git a/labs/html_labs/SQL_Quick_Start_Guide.html b/labs/html_labs/SQL_Quick_Start_Guide.html
new file mode 100644
index 0000000..b27df28
--- /dev/null
+++ b/labs/html_labs/SQL_Quick_Start_Guide.html
@@ -0,0 +1,585 @@
+
+
+
+
+
+ SQL Quick Start Guide
+
+
+
+
+
+
+
+
+
-- Products under $300
+SELECT * FROM products WHERE price < 300;
+
+-- Products in Electronics category
+SELECT * FROM products WHERE category = 'Electronics';
+
+-- Multiple conditions with AND
+SELECT * FROM products
+WHERE category = 'Electronics' AND price < 500;
+
+
+
Pattern Matching with LIKE
+
-- Products starting with 'M'
+SELECT * FROM products WHERE name LIKE 'M%';
+
+-- Products containing 'top'
+SELECT * FROM products WHERE name LIKE '%top%';
+
+
+
+ ✏️ Practice: Find all furniture items priced between $100 and $300.
+
+
+
+
+
3. DISTINCT
+
+
Get Unique Values
+
-- List all unique categories
+SELECT DISTINCT category FROM products;
+
+-- Count unique categories
+SELECT COUNT(DISTINCT category) FROM products;
+
+
+
When to use: Eliminate duplicate rows from results.
+
+
+ ✏️ Practice: Find all unique price values in the products table.
+
+
+
+
+
4. ORDER BY
+
+
Sort Results
+
-- Sort by price (ascending)
+SELECT * FROM products ORDER BY price;
+
+-- Sort by price (descending)
+SELECT * FROM products ORDER BY price DESC;
+
+-- Sort by multiple columns
+SELECT * FROM products ORDER BY category, price DESC;
+
+
+
+ Tips:
+
+
ASC = ascending (default)
+
DESC = descending
+
Can sort by multiple columns
+
+
+
+
+ ✏️ Practice: List all products sorted by category (A-Z) and then by price (high to low).
+
+
+
+
+
5. Foreign Key
+
+
Why Foreign Keys?
+
Foreign keys link tables together and ensure data integrity.
+
+
Create Related Tables
+
-- Suppliers table (parent)
+CREATE TABLE suppliers (
+ id INT PRIMARY KEY,
+ name VARCHAR(50),
+ country VARCHAR(30)
+);
+
+-- Products with foreign key (child)
+CREATE TABLE products_fk (
+ id INT PRIMARY KEY,
+ name VARCHAR(50),
+ price DECIMAL(10,2),
+ supplier_id INT,
+ FOREIGN KEY (supplier_id) REFERENCES suppliers(id)
+);
+
+
+
Add Data
+
-- Add suppliers first
+INSERT INTO suppliers VALUES
+(1, 'TechCorp', 'USA'),
+(2, 'FurnitureCo', 'Canada');
+
+-- Add products that reference suppliers
+INSERT INTO products_fk VALUES
+(1, 'Laptop', 999.99, 1),
+(2, 'Desk', 299.99, 2);
+
+
+
Important: You must insert parent records (suppliers) before child records (products).
+
+
+ ✏️ Practice: Try inserting a product with a supplier_id that doesn't exist. What happens?
+
+
+
+
+
6. Multi Table
+
+
JOIN Tables
+
-- Show products with their supplier information
+SELECT
+ p.name AS product_name,
+ p.price,
+ s.name AS supplier_name,
+ s.country
+FROM products_fk p
+INNER JOIN suppliers s ON p.supplier_id = s.id;
+
+
+
Types of JOINs
+
+
INNER JOIN - Only matching rows
+
SELECT p.name, s.name
+FROM products_fk p
+INNER JOIN suppliers s ON p.supplier_id = s.id;
+
+
+
LEFT JOIN - All from left table, matching from right
+
SELECT p.name, s.name
+FROM products_fk p
+LEFT JOIN suppliers s ON p.supplier_id = s.id;
+
+
+
+ Tip: Start with INNER JOIN. It's the most common.
+
+
+
+ ✏️ Practice: Join customers and orders tables (create these tables first).
+
+
+
+
+
7. Aggregate Functions
+
+
Common Functions
+
-- Count all products
+SELECT COUNT(*) FROM products;
+
+-- Sum of all prices
+SELECT SUM(price) FROM products;
+
+-- Average price
+SELECT AVG(price) FROM products;
+
+-- Highest price
+SELECT MAX(price) FROM products;
+
+-- Lowest price
+SELECT MIN(price) FROM products;
+
+
+
All in One Query
+
SELECT
+ COUNT(*) AS total_products,
+ SUM(price) AS total_value,
+ AVG(price) AS average_price,
+ MAX(price) AS highest_price,
+ MIN(price) AS lowest_price
+FROM products;
+
+
+
+ ✏️ Practice: Calculate the total value of all electronics products.
+
+
+
+
+
8. GROUP BY
+
+
Group Data
+
-- Count products by category
+SELECT category, COUNT(*) AS count
+FROM products
+GROUP BY category;
+
+-- Average price by category
+SELECT category, AVG(price) AS avg_price
+FROM products
+GROUP BY category;
+
+-- Multiple aggregations
+SELECT
+ category,
+ COUNT(*) AS count,
+ AVG(price) AS avg_price,
+ MAX(price) AS max_price
+FROM products
+GROUP BY category;
+
+
+
+ Rule: Every column in SELECT must be either in GROUP BY or an aggregate function.
+
+
+
+ ✏️ Practice: Find the total value of products in each category.
+
+
+
+
+
9. HAVING
+
+
Filter Grouped Results
+
+
WHERE filters rows before grouping
+HAVING filters groups after aggregation
+
+
-- Categories with more than 2 products
+SELECT category, COUNT(*) AS count
+FROM products
+GROUP BY category
+HAVING COUNT(*) > 2;
+
+-- Categories with average price over $300
+SELECT category, AVG(price) AS avg_price
+FROM products
+GROUP BY category
+HAVING AVG(price) > 300;
+
+
+
Combined Example
+
-- Electronics products, grouped by category,
+-- only show groups with avg price > $100
+SELECT category, AVG(price) AS avg_price
+FROM products
+WHERE category = 'Electronics'
+GROUP BY category
+HAVING AVG(price) > 100;
+
+
+
+ ✏️ Practice: Find categories that have at least 1 product and average price under $250.
+
+
+
+
+
10. Set Operations
+
+
UNION - Combine Results
+
-- Combine two queries
+SELECT name FROM products WHERE category = 'Electronics'
+UNION
+SELECT name FROM products WHERE price > 500;
+
+
+
UNION removes duplicates
+UNION ALL keeps duplicates
+
+
-- Keep all rows including duplicates
+SELECT category FROM products WHERE price < 300
+UNION ALL
+SELECT category FROM products WHERE price > 200;
+
+
+
+ Rules:
+
+
Same number of columns in each SELECT
+
Compatible data types
+
Column names from first SELECT are used
+
+
+
+
+ ✏️ Practice: Combine a list of product names under $100 with product names in the Furniture category.
+
+
+
+
+
🎓 Quick Reference Summary
+
+
+
+
Operation
+
SQL Syntax
+
+
+
Create & Insert
+
CREATE TABLE name (columns); INSERT INTO name VALUES (...);
+
+
+
Query
+
SELECT columns FROM table WHERE condition ORDER BY column;
+
+
+
Join
+
SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
+
+
+
Aggregate & Group
+
SELECT col, COUNT(*) FROM table GROUP BY col HAVING COUNT(*) > 1;
+
+
+
Combine
+
SELECT cols FROM t1 UNION SELECT cols FROM t2;
+
+
+
+
+
+
+
📚 Next Steps
+
+
You've learned:
+
+
✅ Creating tables and inserting data
+
✅ Querying and filtering data
+
✅ Sorting and removing duplicates
+
✅ Linking tables with foreign keys
+
✅ Joining multiple tables
+
✅ Calculating statistics
+
✅ Grouping and filtering groups
+
✅ Combining query results
+
+
+
Continue learning:
+
+
Views and Virtual Tables
+
Subqueries and Nested Queries
+
Indexes and Performance
+
Transactions and ACID
+
Stored Procedures and Triggers
+
+
+
+
+
+
+
💡 Tips for Success
+
+
Practice by typing - Don't copy/paste. Type the SQL yourself.
+
Use real data - Create your own tables with data you care about.
+
Read error messages - They tell you exactly what's wrong.
+
Start simple - Master SELECT before complex JOINs.
+
Draw your tables - Sketch table relationships on paper.
+
+
+
From b1124d429a44a1309a7757302d3bddde0c927130 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 11 Feb 2026 04:12:30 +0000
Subject: [PATCH 06/10] Add comprehensive comparison guide between Quick Start
and Comprehensive labs
Co-authored-by: khalefa-ow <88914125+khalefa-ow@users.noreply.github.com>
---
SQL_LAB_COMPARISON.md | 287 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 287 insertions(+)
create mode 100644 SQL_LAB_COMPARISON.md
diff --git a/SQL_LAB_COMPARISON.md b/SQL_LAB_COMPARISON.md
new file mode 100644
index 0000000..7fae004
--- /dev/null
+++ b/SQL_LAB_COMPARISON.md
@@ -0,0 +1,287 @@
+# SQL Lab Comparison Guide
+
+## Overview
+
+This document compares the two SQL learning resources now available in this repository:
+
+1. **SQL Quick Start Guide** (Simplified, New Branch)
+2. **SQL Fundamentals - Complete Guide** (Comprehensive)
+
+---
+
+## Quick Comparison Table
+
+| Feature | SQL Quick Start Guide | SQL Fundamentals - Complete |
+|---------|----------------------|----------------------------|
+| **File** | `SQL_Quick_Start_Guide.md` | `Lab_Reorganized_SQL_Fundamentals.md` |
+| **Branch** | `copilot/sql-quick-start` | `copilot/create-tables-and-queries` |
+| **Length** | 460 lines (~9 KB) | 1,852 lines (~49 KB) |
+| **Estimated Time** | 3-4 hours | 8-12 hours |
+| **Approach** | Fast-track, practical | In-depth, comprehensive |
+| **Examples per Topic** | 1-2 focused | 5-10 detailed |
+| **Practice Exercises** | 10 prompts | 40+ exercises |
+| **Explanations** | Concise bullets | Detailed paragraphs |
+| **Advanced Topics** | Omitted | Included |
+| **Edge Cases** | Omitted | Covered |
+| **Best For** | Quick learners, reference | Thorough study, teaching |
+
+---
+
+## Detailed Comparison
+
+### 1. Structure
+
+**Quick Start:**
+- 10 main topics only
+- 1-2 subsections per topic
+- Quick reference table at end
+- Scannable format
+
+**Comprehensive:**
+- 10 main topics
+- 8-15 subsections per topic
+- Detailed explanations throughout
+- Progressive learning structure
+
+### 2. Content Philosophy
+
+**Quick Start:**
+- "Just enough to get started"
+- One clear example per concept
+- Focus on most common use cases
+- Practical over theoretical
+
+**Comprehensive:**
+- "Everything you need to know"
+- Multiple examples showing variations
+- Cover common and edge cases
+- Theory and practice balanced
+
+### 3. Example: CREATE TABLE Section
+
+**Quick Start (45 lines):**
+```
+- One table creation example
+- Basic data types only
+- One INSERT example
+- One practice prompt
+```
+
+**Comprehensive (200+ lines):**
+```
+- Multiple table examples
+- All common data types explained
+- Multiple INSERT patterns
+- Data verification
+- Additional examples
+- 2 detailed practice exercises
+```
+
+### 4. Example: JOIN Section
+
+**Quick Start:**
+- INNER JOIN focus
+- One complete example
+- Brief mention of LEFT JOIN
+- Simple practice
+
+**Comprehensive:**
+- INNER, LEFT, RIGHT JOINs
+- Multiple examples per type
+- Self-joins explained
+- CROSS JOIN covered
+- 3+ tables examples
+- 5 practice exercises
+
+### 5. Code Examples
+
+**Quick Start:**
+```sql
+-- Single focused example
+SELECT * FROM products
+WHERE price < 300;
+```
+
+**Comprehensive:**
+```sql
+-- Multiple variations shown
+-- Example 1: Simple
+SELECT * FROM products WHERE price < 300;
+
+-- Example 2: With AND
+SELECT * FROM products
+WHERE price < 300 AND category = 'Electronics';
+
+-- Example 3: With OR
+SELECT * FROM products
+WHERE price < 300 OR category = 'Furniture';
+
+-- Example 4: Complex
+SELECT * FROM products
+WHERE (price < 300 OR price > 1000)
+AND category IN ('Electronics', 'Furniture');
+```
+
+---
+
+## When to Use Each Guide
+
+### Use SQL Quick Start Guide If:
+✅ You want to start coding SQL quickly
+✅ You learn best by doing
+✅ You need a quick reference
+✅ You're comfortable figuring things out
+✅ Time is limited (3-4 hours available)
+✅ You prefer concise explanations
+✅ You get overwhelmed by too much detail
+
+### Use SQL Fundamentals Complete If:
+✅ You want thorough understanding
+✅ You're preparing for exams
+✅ You need to teach SQL to others
+✅ You want to see all variations
+✅ Time is not a constraint (8-12 hours available)
+✅ You prefer detailed explanations
+✅ You want to understand edge cases
+
+---
+
+## Learning Path Recommendations
+
+### Path 1: Quick Start First
+1. Complete SQL Quick Start Guide (3-4 hrs)
+2. Practice building your own database
+3. Return to Comprehensive guide for specific topics
+4. **Best for:** Self-motivated learners
+
+### Path 2: Comprehensive Only
+1. Work through Complete Guide sequentially (8-12 hrs)
+2. Complete all exercises
+3. Build a capstone project
+4. **Best for:** Academic learners, instructors
+
+### Path 3: Combined Approach
+1. Skim Quick Start for overview (1 hr)
+2. Use Comprehensive for deep dives (6-8 hrs)
+3. Keep Quick Start as reference
+4. **Best for:** Most learners
+
+---
+
+## Content Coverage
+
+Both guides cover the same 10 topics in the same order:
+
+1. **Create Tables** ✅
+2. **Single Table Query** ✅
+3. **DISTINCT** ✅
+4. **ORDER BY** ✅
+5. **Foreign Key** ✅
+6. **Multi Table** ✅
+7. **Aggregate Functions** ✅
+8. **GROUP BY** ✅
+9. **HAVING** ✅
+10. **Set Operations** ✅
+
+The difference is in depth, not coverage.
+
+---
+
+## What's Simplified in Quick Start?
+
+### Removed:
+- ❌ Advanced subsections
+- ❌ Multiple variations of same concept
+- ❌ Lengthy theoretical explanations
+- ❌ Edge case discussions
+- ❌ Performance optimization details
+- ❌ Common mistakes sections (kept tips only)
+- ❌ Historical context
+- ❌ Multiple practice exercises (kept 1 per section)
+
+### Kept:
+- ✅ Core concepts for each topic
+- ✅ Essential syntax
+- ✅ One clear example per concept
+- ✅ Practice prompts
+- ✅ Quick tips
+- ✅ Resources for further learning
+
+### Added:
+- ➕ Quick reference summary table
+- ➕ Success tips section
+- ➕ Consistent single dataset throughout
+- ➕ More white space for readability
+
+---
+
+## File Locations
+
+### Quick Start Guide
+- **Markdown**: `/SQL_Quick_Start_Guide.md`
+- **HTML**: `/labs/html_labs/SQL_Quick_Start_Guide.html`
+- **Branch**: `copilot/sql-quick-start`
+
+### Comprehensive Guide
+- **Markdown**: `/Lab_Reorganized_SQL_Fundamentals.md`
+- **HTML**: `/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html`
+- **Branch**: `copilot/create-tables-and-queries`
+
+---
+
+## Statistics
+
+### Quick Start Guide
+- Lines of code: 460
+- File size: ~9 KB
+- Sections: 10 main topics
+- Subsections: ~20 total
+- Code examples: ~20
+- Practice prompts: 10
+- Estimated reading: 45 minutes
+- Estimated practice: 2.5-3.5 hours
+
+### Comprehensive Guide
+- Lines of code: 1,852
+- File size: ~49 KB
+- Sections: 10 main topics
+- Subsections: 142 total
+- Code examples: 100+
+- Practice exercises: 40+
+- Estimated reading: 3-4 hours
+- Estimated practice: 5-8 hours
+
+---
+
+## Feedback and Improvements
+
+Both guides are living documents. If you:
+- Find errors or typos
+- Have suggestions for improvement
+- Want additional examples
+- Need clarification on concepts
+
+Please open an issue or submit a pull request!
+
+---
+
+## Conclusion
+
+**Both guides teach the same fundamental SQL concepts.**
+
+The difference is pedagogical approach:
+- Quick Start = "Show me what I need, now"
+- Comprehensive = "Teach me everything about this"
+
+Choose based on your:
+- Learning style
+- Time available
+- Goals (quick start vs deep mastery)
+- Use case (reference vs study)
+
+**Most importantly: Both will make you proficient in SQL!** 🚀
+
+---
+
+**Created:** February 11, 2026
+**Purpose:** Help learners choose the right guide for their needs
From e659eb1bb3f79492ac36a07b26d069dcfbdcc5fc Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 11 Feb 2026 05:38:49 +0000
Subject: [PATCH 07/10] Remove comprehensive lab files and simplify to Quick
Start Guide only
Co-authored-by: khalefa-ow <88914125+khalefa-ow@users.noreply.github.com>
---
CHANGELOG.md | 204 --
CONTRIBUTORS.md | 151 --
LAB_INDEX.md | 684 +-----
Lab_Reorganized_SQL_Fundamentals.md | 1852 -----------------
PROJECT_COMPLETION_REPORT.md | 284 ---
REORGANIZED_LAB_SUMMARY.md | 151 --
Readme.md | 239 +--
S26_SUMMARY.md | 293 ---
SQL_LAB_COMPARISON.md | 287 ---
.../Lab_Reorganized_SQL_Fundamentals.html | 235 ---
10 files changed, 71 insertions(+), 4309 deletions(-)
delete mode 100644 CHANGELOG.md
delete mode 100644 CONTRIBUTORS.md
delete mode 100644 Lab_Reorganized_SQL_Fundamentals.md
delete mode 100644 PROJECT_COMPLETION_REPORT.md
delete mode 100644 REORGANIZED_LAB_SUMMARY.md
delete mode 100644 S26_SUMMARY.md
delete mode 100644 SQL_LAB_COMPARISON.md
delete mode 100644 labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 450d427..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,204 +0,0 @@
-# Changelog
-
-All notable changes to this project will be documented in this file.
-
-The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
-and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-
-## [2.0.0] - 2026-02-07 (s26 Branch)
-
-### 🎉 Major Release: Enhanced Documentation and Organization
-
-This release represents a major overhaul of the repository structure and documentation, making it significantly more accessible and organized for learners and instructors.
-
-### Added
-
-#### 📚 Comprehensive Documentation
-- **[Getting Started Guide](docs/GETTING_STARTED.md)**
- - Complete setup instructions for MySQL, Python, Java, Node.js
- - Troubleshooting section for common issues
- - Quick start guides for different skill levels
- - Tool installation guides for MongoDB, Neo4j, Jupyter
-
-- **[Course Syllabus](docs/COURSE_SYLLABUS.md)**
- - 16-week structured curriculum
- - Weekly schedule with topics and labs
- - Grading policy and assessment guidelines
- - Project ideas and deliverables
- - Learning outcomes for each module
-
-- **[SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md)**
- - Comprehensive reference for all SQL commands
- - Organized by topic (DDL, DML, Queries, Joins, etc.)
- - Code examples for every command
- - Best practices and performance tips
- - Window functions and CTEs reference
-
-- **[Contributing Guide](docs/CONTRIBUTING.md)**
- - Detailed contribution guidelines
- - Code style standards for SQL, Python, Java
- - Pull request process
- - Issue reporting templates
- - Commit message conventions
-
-- **[Lab Index](LAB_INDEX.md)**
- - Complete catalog of all 21 labs
- - Detailed descriptions with learning objectives
- - Prerequisites for each lab
- - Duration estimates
- - Difficulty levels (Beginner to Expert)
- - Multiple learning paths
-
-- **[Practice Exercises](exercises/PRACTICE_EXERCISES.md)**
- - Additional exercises by topic
- - Challenge problems for advanced learners
- - Difficulty ratings
- - Links to external practice platforms
-
-- **[Project Roadmap](docs/ROADMAP.md)**
- - Short, medium, and long-term goals
- - Feature development timeline
- - Success metrics
- - How to contribute to roadmap
-
-#### 🗂️ Repository Organization
-- Created `/labs` directory structure
- - `/labs/html_labs` - All HTML lab files organized
- - `/labs/notebooks` - Jupyter notebook labs
- - `/labs/code` - Programming examples
-
-- Created `/docs` directory for documentation
-- Created `/exercises` directory for practice problems
-- Created `/solutions` directory (structure for future solutions)
-- Created `/supplementary` directory (for additional materials)
-
-#### ✨ Enhanced Features
-- Added badges to README (stars, license, PRs welcome)
-- Quick links section in README
-- Learning paths for different skill levels
-- Search by topic in Lab Index
-- Multiple ways to navigate content
-
-### Changed
-
-#### 📝 README Improvements
-- Restructured for better navigation
-- Added Quick Links section at the top
-- Updated lab references to use new structure
-- Added highlights for featured labs (⭐)
-- Improved descriptions and organization
-- Added "How to Use This Repository" section
-
-#### 🔧 Configuration
-- Enhanced `.gitignore` file
- - Exclude Mac .DS_Store files
- - Exclude Python cache files
- - Exclude node_modules
- - Exclude IDE files
- - Exclude credentials and secrets
-
-### Improved
-
-- Better cross-referencing between documents
-- Consistent formatting across all markdown files
-- More descriptive file names
-- Improved accessibility with clear hierarchy
-- Better onboarding for new contributors
-- Enhanced discoverability of resources
-
-### Fixed
-
-- Fixed CASE Expressions lab link in README
-- Corrected file path references
-- Improved consistency in documentation style
-
----
-
-## [1.0.0] - Initial Release
-
-### Added
-- 21 comprehensive SQL labs covering:
- - Database Creation & Basic Queries
- - Advanced Queries & Joins
- - Foreign Keys & Relationships
- - Multi-Table Operations
- - Set Operations & Nested Queries
- - Aggregate Functions & Grouping
- - CASE Expressions
- - Window Functions & Recursive Queries
- - Views & Virtual Tables
- - Database Normalization
- - Advanced SQL Techniques
- - Java Database Interface
- - Python Database Interface
- - Jupyter Notebook Integration
- - Analytical Functions (ROLLUP, CUBE)
- - Triggers & Stored Procedures
- - Transaction Management
- - Isolation Levels
- - JSON & XML Processing
- - MongoDB (NoSQL)
- - Neo4j (Graph Database)
-
-- Dataset Files:
- - IMDB Movie Data
- - Air Travel Data
- - Cities Data
- - Employee Data
- - Student Grades
- - Drivers Database
-
-- Code Examples:
- - Node.js database integration
- - Express.js server examples
- - JavaScript client code
-
-- Jupyter Notebooks:
- - MySQL-Jupyter integration
- - ROLLUP examples
- - Triggers examples
-
-- Supplementary Materials:
- - In-Class Exercise (Workers Database)
- - CASE Expression detailed guide (markdown)
- - Bank triggers assignment
- - ORM introduction document
-
-- Basic Documentation:
- - README with lab overview
- - GitHub Pages site
-
----
-
-## Upcoming Changes (Planned)
-
-### Version 2.1 (Next Minor Release)
-- [ ] Convert HTML labs to Markdown format
-- [ ] Add solution guides for all exercises
-- [ ] Create video tutorial links
-- [ ] Add assessment rubrics
-
-### Version 3.0 (Next Major Release)
-- [ ] Interactive SQL playground
-- [ ] Auto-grading system
-- [ ] Video content for each lab
-- [ ] Multi-language support
-
----
-
-## Contributing
-
-See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for details on how to contribute to this changelog.
-
----
-
-## Links
-
-- [Repository](https://github.com/TeachingOW/DBMS-SQL-Labs)
-- [Website](https://teachingow.github.io/DBMS-SQL-Labs/)
-- [Issues](https://github.com/TeachingOW/DBMS-SQL-Labs/issues)
-- [Pull Requests](https://github.com/TeachingOW/DBMS-SQL-Labs/pulls)
-
----
-
-**Note**: All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/).
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
deleted file mode 100644
index 28aee93..0000000
--- a/CONTRIBUTORS.md
+++ /dev/null
@@ -1,151 +0,0 @@
-# Contributors
-
-This project exists thanks to all the people who contribute. Thank you! 🙏
-
-## Core Team
-
-### Project Creator & Lead Maintainer
-- **TeachingOW** - [@TeachingOW](https://github.com/TeachingOW)
- - Repository creator and primary maintainer
- - Course design and curriculum development
- - Lab content creation
-
-### Co-Maintainers
-- **khalefa-ow** - [@khalefa-ow](https://github.com/khalefa-ow)
- - Content review and enhancement
- - Technical guidance
-
-## Contributors
-
-We welcome contributions from everyone! Here are some of the ways people have helped:
-
-### Content Contributors
-*Add your name here when you contribute content!*
-
-
-
-### Documentation Contributors
-*Contributors who have improved documentation*
-
-### Code Contributors
-*Contributors who have added code examples or tools*
-
-### Translation Contributors
-*Contributors who have helped translate content*
-
-### Bug Reporters
-*People who have reported issues and helped improve quality*
-
----
-
-## How to Be Listed Here
-
-Contributing to this project means:
-
-### Types of Contributions
-- **Content Creation**: New labs, exercises, or examples
-- **Documentation**: Improving guides, README, or inline docs
-- **Bug Fixes**: Correcting errors in content or code
-- **Translations**: Making content available in other languages
-- **Reviews**: Providing feedback on pull requests
-- **Support**: Helping others in issues or discussions
-- **Ideas**: Suggesting improvements or new features
-
-### Getting Listed
-1. Make a meaningful contribution to the project
-2. Your contribution is merged via pull request
-3. Add your name to this file (or we'll add it for you)
-4. Include:
- - Your name
- - Your GitHub profile link
- - Brief description of your contribution
-
-### Contribution Guidelines
-Please see our [Contributing Guide](docs/CONTRIBUTING.md) for details on:
-- How to submit changes
-- Code style guidelines
-- Pull request process
-- Communication channels
-
----
-
-## Special Thanks
-
-### Educational Institutions
-Thanks to the educational institutions that have used and provided feedback on these materials:
-- *Your institution could be listed here!*
-
-### Community Supporters
-Thanks to everyone who has:
-- ⭐ Starred the repository
-- 🍴 Forked the project
-- 📢 Shared the project with others
-- 💬 Participated in discussions
-- 🐛 Reported issues
-
-### Tools and Platforms
-- **GitHub** - For hosting and collaboration
-- **GitHub Pages** - For documentation hosting
-- **MySQL** - For the database system
-- **MongoDB** - For NoSQL examples
-- **Neo4j** - For graph database examples
-
----
-
-## Recognition
-
-### Top Contributors
-*Based on number of merged pull requests*
-
-1. TeachingOW - Project creator
-2. khalefa-ow - Co-maintainer
-
-*Your name could be here! Start contributing today.*
-
-### First-Time Contributors
-We love welcoming new contributors! Here are some of our first-time contributors:
-
-*This section will grow as more people contribute!*
-
----
-
-## Stats
-
-- **Total Contributors**: 2+
-- **Total Commits**: 100+
-- **Total Stars**: Growing!
-- **Total Forks**: Growing!
-
-*Stats as of February 2026*
-
----
-
-## Join Us!
-
-We're always looking for contributors. Whether you're:
-- 👨🎓 A student who has completed the labs
-- 👨🏫 An educator with teaching experience
-- 👨💻 A developer with database expertise
-- 📝 A technical writer
-- 🌍 A translator
-- 🎨 A designer
-
-You can contribute! See our [Contributing Guide](docs/CONTRIBUTING.md) to get started.
-
----
-
-## Contact
-
-- **Issues**: [GitHub Issues](https://github.com/TeachingOW/DBMS-SQL-Labs/issues)
-- **Discussions**: [GitHub Discussions](https://github.com/TeachingOW/DBMS-SQL-Labs/discussions)
-- **Website**: [teachingow.github.io/DBMS-SQL-Labs](https://teachingow.github.io/DBMS-SQL-Labs/)
-
----
-
-**Note**: This list is maintained manually. If you've contributed and don't see your name, please open a PR to add yourself!
-
-*Last updated: February 2026*
diff --git a/LAB_INDEX.md b/LAB_INDEX.md
index 9b5a6d3..6533c87 100644
--- a/LAB_INDEX.md
+++ b/LAB_INDEX.md
@@ -1,29 +1,28 @@
-# DBMS-SQL-Labs - Complete Lab Index
+# SQL Quick Start Guide - Lab Index
## 📑 Quick Navigation
-- [Getting Started Guide](docs/GETTING_STARTED.md)
-- [Course Syllabus](docs/COURSE_SYLLABUS.md)
-- [SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md)
-- [Contributing Guide](docs/CONTRIBUTING.md)
+- [SQL Quick Start Guide](SQL_Quick_Start_Guide.md) - Main guide
+- [HTML Version](labs/html_labs/SQL_Quick_Start_Guide.html) - Web-friendly format
+- [SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md) - Quick reference
- [Main README](Readme.md)
---
-## 🆕 NEW: Quick Start & Comprehensive SQL Labs
+## ⚡ SQL Quick Start Guide
-### ⚡ SQL Quick Start Guide ⭐ NEW
**Topics**: All fundamental SQL concepts in streamlined format
**Duration**: 3-4 hours (fast-track)
**Prerequisites**: None - Perfect for quick learners!
-**Link**: [SQL Quick Start Guide](SQL_Quick_Start_Guide.md) | [HTML Version](labs/html_labs/SQL_Quick_Start_Guide.html)
+**Links**: [Markdown](SQL_Quick_Start_Guide.md) | [HTML](labs/html_labs/SQL_Quick_Start_Guide.html)
+
+### What You'll Learn
-**What You'll Learn:**
A streamlined, beginner-friendly guide that gets you coding fast! Each section is concise with practical examples:
1. **Create Tables** - Quick setup with essential syntax
2. **Single Table Query** - Core SELECT queries and filtering
-3. **DISTINCT** - Remove duplicates (1-2 examples)
+3. **DISTINCT** - Remove duplicates
4. **ORDER BY** - Sort results efficiently
5. **Foreign Key** - Link tables with integrity
6. **Multi Table** - Focus on INNER JOIN
@@ -32,672 +31,37 @@ A streamlined, beginner-friendly guide that gets you coding fast! Each section i
9. **HAVING** - Filter grouped data
10. **Set Operations** - Combine results with UNION
-**Why This Guide?**
+### Why This Guide?
+
- ✅ **Fast**: Learn SQL in 3-4 hours
- ✅ **Practical**: Code examples you can run immediately
- ✅ **Simple**: No information overload - just what you need
- ✅ **Hands-on**: Practice exercises after each topic
- ✅ **Reference**: Quick syntax reference included
-**Best for:** Complete beginners, fast learners, developers who prefer learning by doing, quick reference needs.
-
----
-
-### 📚 SQL Fundamentals - Complete Reorganized Guide
-**Topics**: All fundamental SQL concepts in logical order
-**Duration**: 8-12 hours (self-paced)
-**Prerequisites**: None - Comprehensive for all levels!
-**Link**: [Reorganized SQL Fundamentals Lab](Lab_Reorganized_SQL_Fundamentals.md) | [HTML Version](labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html)
-
-**What You'll Learn:**
-This comprehensive guide consolidates all fundamental SQL concepts into a single, logically ordered resource:
-
-1. **Create Tables** - Database and table creation with data types and constraints
-2. **Single Table Query** - SELECT statements with WHERE, operators, and pattern matching
-3. **DISTINCT** - Removing duplicates and finding unique values
-4. **ORDER BY** - Sorting data in ascending/descending order
-5. **Foreign Key** - Referential integrity and table relationships
-6. **Multi Table** - JOINs (INNER, LEFT, RIGHT) and multi-table queries
-7. **Aggregate Function** - COUNT, SUM, AVG, MAX, MIN for data analysis
-8. **GROUP BY** - Grouping data for summary statistics
-9. **HAVING** - Filtering grouped results
-10. **Set Operation** - UNION, UNION ALL, and set operations
-
-**Key Features:**
-- ✅ Progressive learning structure - each topic builds on previous ones
-- ✅ Comprehensive examples with real-world scenarios
-- ✅ 40+ practice exercises for every section
-- ✅ Common mistakes and best practices
-- ✅ Performance tips and optimization suggestions
-- ✅ Complete code examples ready to run
-
-**Why This Lab?**
-This reorganized lab presents SQL fundamentals in the most logical learning order, making it easier for beginners to grasp concepts progressively while providing a comprehensive reference for all skill levels.
-
-**Best for:** Thorough learners, students preparing for exams, those who want deep understanding, instructors teaching SQL.
-
----
-
-## 📚 All Labs by Category
-
-### 🟢 Beginner Level (Start Here!)
-
-#### Lab 1: Database Creation & Basic Queries
-**Topics**: CREATE DATABASE, CREATE TABLE, INSERT, SELECT basics
-**Duration**: 2-3 hours
-**Prerequisites**: None
-**Link**: [Lab 1](labs/html_labs/InClassExercises.html)
-
-**What You'll Learn:**
-- Create databases and tables
-- Insert data into tables
-- Select data with WHERE clause
-- Use basic filtering and sorting
-
-**Key Concepts**: `CREATE`, `INSERT`, `SELECT`, `WHERE`, `ORDER BY`, `LIMIT`
-
----
-
-#### In-Class Exercise: Workers Database
-**Topics**: Practical application of Lab 1 concepts
-**Duration**: 1-2 hours
-**Prerequisites**: Lab 1
-**Link**: [Workers Exercise](In-Class%20Exercise)
-
-**What You'll Learn:**
-- Apply constraints (PRIMARY KEY, NOT NULL)
-- Work with real-world data relationships
-- Practice data modeling
-
----
-
-#### Lab 2: JOINs and Multi-Table Queries
-**Topics**: INNER/LEFT/RIGHT joins, multi-table queries
-**Duration**: 1.5-2 hours
-**Prerequisites**: Lab 1
-**Link**: [Lab 2](labs/html_labs/Lab2_Part1_Joins.html)
-
-**What You'll Learn:**
-- INNER JOIN, LEFT JOIN, RIGHT JOIN
-- Multi-table queries with 3+ tables
-- Complex WHERE conditions
-- Table and column aliases
-- String functions with JOINs
-- Combining data from multiple sources
-
-**Key Concepts**: `JOIN`, `ON`, `USING`, `CONCAT`, aliases
-
-**Examples Included**:
-- University database with students, courses, and enrollments
-- Employee-Department relationships
-- Product catalogs with suppliers
-
----
-
-#### Lab 3: Aggregate Functions and GROUP BY
-**Topics**: COUNT, SUM, AVG, GROUP BY, HAVING
-**Duration**: 1.5-2 hours
-**Prerequisites**: Lab 1, Lab 2
-**Link**: [Lab 3](labs/html_labs/Lab2_Part2_Aggregates.html)
-
-**What You'll Learn:**
-- COUNT, SUM, AVG, MIN, MAX
-- GROUP BY clause
-- HAVING clause for filtering groups
-- COUNT() vs COUNT(DISTINCT)
-- Combining aggregates with JOINs
-- Statistical analysis of data
-
-**Key Concepts**: `COUNT`, `SUM`, `AVG`, `GROUP BY`, `HAVING`
-
-**Examples Included**:
-- Sales analysis and revenue calculations
-- Student performance statistics
-- Inventory management aggregations
-
----
-
-#### Lab 4: Set Operations and Advanced Queries
-**Topics**: UNION, set operations, complex queries
-**Duration**: 1.5-2 hours
-**Prerequisites**: Lab 2, Lab 3
-**Link**: [Lab 4](labs/html_labs/Lab2_Part3_SetOperations.html)
-
-**What You'll Learn:**
-- UNION and UNION ALL
-- Set operations (MySQL alternatives for INTERSECT)
-- UPDATE and DELETE with multiple rows
-- Division operation in SQL
-- Complex nested subqueries
-- Data merging from multiple sources
-
-**Key Concepts**: `UNION`, `UNION ALL`, nested queries, division
-
-**Examples Included**:
-- Combining customer data from multiple sources
-- Finding common elements across tables
-- Complex filtering with subqueries
-
----
-
-#### Lab 5: Foreign Keys & Relationships
-**Topics**: Referential integrity, relationships
-**Duration**: 2 hours
-**Prerequisites**: Lab 1, Lab 2
-**Link**: [Lab 5](labs/html_labs/Foreign_Keys.html)
-
-**What You'll Learn:**
-- Create foreign key constraints
-- Understand parent-child relationships
-- Implement referential integrity
-- CASCADE operations
-- Managing relationships in database design
-
-**Key Concepts**: `FOREIGN KEY`, `REFERENCES`, `ON DELETE CASCADE`
-
-**Examples Included**:
-- Customer-Order relationships
-- Department-Employee hierarchies
-- Product-Category associations
-
----
-
-#### Lab 6: Multi-Table Operations
-**Topics**: Complex joins, multiple table queries
-**Duration**: 3 hours
-**Prerequisites**: Lab 2, Lab 5
-**Link**: [Lab 6](labs/html_labs/Multi_Tables.html)
-
-**What You'll Learn:**
-- Join 3+ tables
-- Self-joins
-- Cross joins
-- Query optimization basics
-- Complex relationship navigation
-
-**Examples Included**:
-- Multi-level organizational structures
-- Supply chain queries with multiple vendors
-- Social network friend-of-friend queries
-
----
-
-### 🟡 Intermediate Level
-
-#### Lab 7: CASE Expressions
-**Topics**: Conditional logic in SQL
-**Duration**: 2-3 hours
-**Prerequisites**: Lab 3
-**Link**: [Lab 7](Lab_Case_Expression.md)
-
-**What You'll Learn:**
-- Simple CASE expressions
-- Searched CASE expressions
-- CASE with aggregate functions
-- Conditional counting and summing
-- Real-world data categorization
-- Data transformation techniques
-
-**Key Concepts**: `CASE WHEN`, conditional logic, data transformation
-
-**Highlights**:
-- ✨ Comprehensive guide with real-world examples
-- ✨ Compare different query approaches
-- ✨ Practice exercises with solutions
-
-**Examples Included**:
-- Grade categorization (A, B, C, etc.)
-- Sales tier classification
-- Customer segmentation
-- Performance rating systems
-
----
-
-#### Lab 8: Window Functions & Recursive Queries
-**Topics**: Analytical functions, partitioning
-**Duration**: 3-4 hours
-**Prerequisites**: Lab 3
-**Link**: [Lab 8](labs/html_labs/Lab4.html)
-
-**What You'll Learn:**
-- ROW_NUMBER, RANK, DENSE_RANK
-- PARTITION BY clause
-- Running totals
-- Moving averages
-- Recursive CTEs
-- Advanced analytical operations
-
-**Key Concepts**: Window functions, `OVER`, `PARTITION BY`, recursion
-
-**Examples Included**:
-- Top N queries per category
-- Running sum calculations
-- Year-over-year comparisons
-- Hierarchical data traversal
-
----
-
-#### Lab 9: Views & Virtual Tables
-**Topics**: Creating and managing views
-**Duration**: 2 hours
-**Prerequisites**: Lab 2
-**Link**: [Lab 9](labs/html_labs/Lab5_views.html)
-
-**What You'll Learn:**
-- Create views
-- Query views
-- Update through views
-- Materialized views concept
-- Security and abstraction benefits
-
-**Key Concepts**: `CREATE VIEW`, virtual tables, data abstraction
-
-**Examples Included**:
-- Employee summary views
-- Sales dashboard views
-- Filtered data access for different user roles
-
----
-
-### 🟠 Database Design & Advanced SQL
-
-#### Lab 10: Database Normalization
-**Topics**: 1NF, 2NF, 3NF, BCNF
-**Duration**: 3-4 hours
-**Prerequisites**: Lab 5
-**Link**: [Lab 10](labs/html_labs/Lab3_Normal_forms.html)
-
-**What You'll Learn:**
-- Database normalization principles
-- First, Second, Third Normal Forms
-- Boyce-Codd Normal Form
-- When to denormalize
-- Design patterns
-- Dependency analysis
-
-**Key Concepts**: Normalization, dependencies, decomposition
-
-**Examples Included**:
-- Poorly designed database transformations
-- Student registration system normalization
-- E-commerce database design
-
----
-
-#### Lab 11: Advanced SQL Techniques
-**Topics**: Complex queries and optimization
-**Duration**: 3 hours
-**Prerequisites**: Lab 8
-**Link**: [Lab 11](labs/html_labs/Lab4_sql.html)
-
-**What You'll Learn:**
-- Query optimization
-- Complex analytical queries
-- Advanced subquery techniques
-- Performance considerations
-- Index usage strategies
-
-**Examples Included**:
-- Query execution plan analysis
-- Optimizing slow queries
-- Complex reporting queries
-
----
-
-### 🔵 Programming Integration
-
-#### Lab 12: Java Database Interface
-**Topics**: JDBC, connecting Java to databases
-**Duration**: 3-4 hours
-**Prerequisites**: Basic Java knowledge
-**Link**: [Lab 12](labs/html_labs/lab_java_3.html)
-
-**What You'll Learn:**
-- JDBC basics
-- Connection management
-- PreparedStatements
-- ResultSet handling
-- Error handling
-- Connection pooling
-
-**Key Concepts**: JDBC, `Connection`, `Statement`, `ResultSet`
-
-**Examples Included**:
-- Simple CRUD operations in Java
-- Database-backed Java applications
-- Transaction management in JDBC
-
----
-
-#### Lab 13: Python Database Interface
-**Topics**: Python MySQL connector
-**Duration**: 2-3 hours
-**Prerequisites**: Basic Python knowledge
-**Link**: [Lab 13](labs/html_labs/Lab_Python.html)
-
-**What You'll Learn:**
-- mysql-connector-python
-- PyMySQL
-- Connection pooling
-- Parameterized queries
-- Error handling
-- Pandas integration
-
-**Key Concepts**: Python DB-API, connectors, cursors
-
-**Examples Included**:
-- Database operations with Python
-- Data analysis with Pandas
-- Web application database backends
-
----
-
-#### Lab 14: Jupyter Notebook Integration
-**Topics**: Interactive database analysis
-**Duration**: 2 hours
-**Prerequisites**: Lab 13
-**Link**: [Lab 14](https://nbviewer.org/github/teachingow/DBMS-SQL-Labs/blob/main/inclass/Mysql-Jupyter.ipynb)
-
-**What You'll Learn:**
-- IPython SQL magic
-- Pandas integration
-- Data visualization
-- Interactive queries
-- Exploratory data analysis
-
-**Examples Included**:
-- Interactive SQL queries in Jupyter
-- Data visualization with matplotlib
-- Statistical analysis of database data
-
----
-
-### 🟣 Advanced Database Concepts
-
-#### Lab 15: Analytical Functions
-**Topics**: ROLLUP, CUBE, advanced grouping
-**Duration**: 2-3 hours
-**Prerequisites**: Lab 3, Lab 8
-**Link**: [Lab 15](https://nbviewer.org/github/teachingow/DBMS-SQL-Labs/blob/main/inclass/Rollup.ipynb)
-
-**What You'll Learn:**
-- ROLLUP for subtotals
-- CUBE for multi-dimensional analysis
-- GROUPING function
-- Advanced analytics
-- Cross-tabulation queries
-
-**Key Concepts**: `ROLLUP`, `CUBE`, `GROUPING SETS`
-
-**Examples Included**:
-- Sales reports with subtotals
-- Multi-dimensional analysis
-- Pivot table-like queries
-
----
-
-#### Lab 16: Triggers & Stored Procedures
-**Topics**: Database automation and business logic
-**Duration**: 3-4 hours
-**Prerequisites**: Lab 11
-**Link**: [Lab 16](labs/html_labs/Triggers.html)
-
-**What You'll Learn:**
-- Create triggers (BEFORE/AFTER)
-- Stored procedures
-- Functions
-- Parameters
-- Error handling
-- Audit logging
-
-**Key Concepts**: `TRIGGER`, `PROCEDURE`, `FUNCTION`, automation
-
-**Related Assignment**: [Bank Overdraft System](bank.md)
-
-**Examples Included**:
-- Automatic timestamp updates
-- Audit trail implementation
-- Business rule enforcement
-- Data validation triggers
-
----
-
-#### Lab 17: Transaction Management
-**Topics**: ACID properties, concurrency
-**Duration**: 3 hours
-**Prerequisites**: Lab 16
-**Link**: [Lab 17](labs/html_labs/Transactions.html)
-
-**What You'll Learn:**
-- BEGIN, COMMIT, ROLLBACK
-- ACID properties
-- Transaction isolation
-- Savepoints
-- Deadlock handling
-- Error recovery
-
-**Key Concepts**: Transactions, `COMMIT`, `ROLLBACK`, ACID
-
-**Examples Included**:
-- Banking transaction scenarios
-- Multi-step operations
-- Error handling and rollback
-
----
-
-#### Lab 18: Isolation Levels
-**Topics**: Concurrency control, consistency
-**Duration**: 2-3 hours
-**Prerequisites**: Lab 17
-**Link**: [Lab 18](labs/html_labs/Isolation_Levels.html)
-
-**What You'll Learn:**
-- READ UNCOMMITTED
-- READ COMMITTED
-- REPEATABLE READ
-- SERIALIZABLE
-- Dirty reads, phantom reads
-- Concurrency issues
-
-**Key Concepts**: Isolation levels, concurrency problems
-
-**Examples Included**:
-- Demonstrating dirty reads
-- Phantom read scenarios
-- Non-repeatable read examples
-
----
-
-### 🔴 Modern Database Technologies
-
-#### Lab 19: JSON & XML Processing
-**Topics**: Semi-structured data in SQL
-**Duration**: 2-3 hours
-**Prerequisites**: Lab 2
-**Link**: [Lab 19](labs/html_labs/Lab_JSON-XML.html)
-
-**What You'll Learn:**
-- JSON data type
-- JSON functions
-- XML handling
-- Querying nested data
-- Storing semi-structured data
-
-**Key Concepts**: JSON, XML, semi-structured data
-
-**Examples Included**:
-- Storing and querying JSON documents
-- Extracting values from nested JSON
-- XML data manipulation
-
----
-
-#### Lab 20: MongoDB (NoSQL)
-**Topics**: Document-based databases
-**Duration**: 3-4 hours
-**Prerequisites**: Basic database knowledge
-**Link**: [Lab 20](labs/html_labs/Lab10_mongoDB.html)
-
-**What You'll Learn:**
-- MongoDB basics
-- Document model
-- CRUD operations
-- Aggregation pipeline
-- When to use NoSQL
-- Schema design for documents
-
-**Key Concepts**: NoSQL, documents, collections, MongoDB
-
-**Examples Included**:
-- Blog post storage and retrieval
-- E-commerce product catalogs
-- Social media data modeling
-
----
-
-#### Lab 21: Neo4j (Graph Database)
-**Topics**: Graph database concepts
-**Duration**: 3-4 hours
-**Prerequisites**: Basic database knowledge
-**Link**: [Lab 21](labs/html_labs/Lab11_neo4j.html)
-
-**What You'll Learn:**
-- Graph data model
-- Nodes and relationships
-- Cypher query language
-- Path queries
-- Graph algorithms
-- When to use graph databases
-
-**Key Concepts**: Graph databases, Cypher, nodes, edges
-
-**Examples Included**:
-- Social network modeling
-- Recommendation engines
-- Shortest path problems
-- Network analysis
-
----
-
-## 📊 Learning Paths
-
-### Path 1: Complete Beginner to SQL Master (16 weeks)
-Week 1-2: Labs 1-2
-Week 3-4: Labs 3-6
-Week 5-6: Labs 7-9
-Week 7-8: Labs 10-11
-Week 9-10: Labs 12-13, 16-18
-Week 11-12: Labs 14-15
-Week 13-16: Labs 19-21 and capstone project
-
-### Path 2: Quick SQL Review (4 weeks)
-Week 1: Labs 1-3
-Week 2: Labs 4-8
-Week 3: Labs 16-17
-Week 4: Labs 20-21
-
-### Path 3: Programming Integration Focus (6 weeks)
-Week 1-2: Labs 1-3 (refresh)
-Week 3: Labs 12-13 (Python/Java)
-Week 4: Lab 14 (Jupyter)
-Week 5: Labs 16-17 (Triggers/Transactions)
-Week 6: Project work
-
-### Path 4: Modern Databases (4 weeks)
-Week 1: Labs 7-8 (SQL advanced)
-Week 2: Lab 19 (JSON/XML)
-Week 3: Lab 20 (MongoDB)
-Week 4: Lab 21 (Neo4j)
-
-### Path 5: Data Analysis Track (5 weeks)
-Week 1: Labs 1-3 (Foundations)
-Week 2: Labs 7-8 (CASE & Window Functions)
-Week 3: Labs 13-14 (Python & Jupyter)
-Week 4: Lab 15 (ROLLUP/CUBE)
-Week 5: Labs 19-20 (JSON & MongoDB)
-
----
-
-## 📁 Additional Resources
-
-### Data Files
-All practice datasets are in the `/data` directory:
-- `IMDB-Movie-Data.csv` - Movie database
-- `employees.csv` - HR data
-- `drivers.sql` - Complete database example
-- `grades.csv` - Student performance
-- `cities.csv` - Geographic data
-- `airtravel.csv` - Flight data
-
-### Code Examples
-Programming examples in `/labs/code`:
-- Lab 6: Node.js examples
-- Lab 7: Express.js server
-- Lab 8: Web application
-
-### Jupyter Notebooks
-Interactive notebooks in `/labs/notebooks`:
-- Mysql-Jupyter.ipynb
-- Rollup.ipynb
-- Triggers.ipynb
-
----
-
-## 🎯 Lab Difficulty Levels
-
-| Level | Labs | Description |
-|-------|------|-------------|
-| 🟢 Beginner | 1-6 | Basic SQL, tables, joins |
-| 🟡 Intermediate | 7-9 | Advanced queries, window functions |
-| 🟠 Advanced SQL | 10-11 | Design, optimization |
-| 🔵 Programming | 12-14 | Integration with code |
-| 🟣 Expert | 15-18 | Triggers, transactions |
-| 🔴 Modern | 19-21 | NoSQL, Graph databases |
-
----
-
-## 🔍 Search by Topic
+### Best For
-**Basic Operations**: Labs 1, 2
-**Joins**: Labs 2, 5, 6
-**Aggregations**: Labs 3, 15
-**Subqueries**: Labs 4, 7
-**Window Functions**: Lab 8
-**Views**: Lab 9
-**Database Design**: Labs 5, 10
-**Stored Procedures**: Lab 16
-**Triggers**: Lab 16
-**Transactions**: Labs 17, 18
-**Python**: Lab 13, 14
-**Java**: Lab 12
-**NoSQL**: Lab 20
-**Graph Databases**: Lab 21
-**JSON/XML**: Lab 19
+Complete beginners, fast learners, developers who prefer learning by doing, quick reference needs.
---
-## ✅ Recommended Order for Self-Study
+## 🚀 Getting Started
-1. Start with [Getting Started Guide](docs/GETTING_STARTED.md)
-2. Complete Labs 1-6 (Foundations)
-3. Continue with Labs 7-9 (Intermediate)
-4. Study Lab 10 (Design)
-5. Pick programming language: Lab 12 (Java) or Lab 13 (Python)
-6. Complete Labs 16-18 (Advanced concepts)
-7. Explore Labs 19-21 (Modern databases)
+1. Install MySQL or MariaDB
+2. Open the [SQL Quick Start Guide](SQL_Quick_Start_Guide.md)
+3. Follow along with examples
+4. Complete practice exercises
+5. Build your own databases!
---
-## 🆘 Need Help?
+## 📝 Additional Resources
-- 📖 Check [Getting Started Guide](docs/GETTING_STARTED.md)
-- 📝 Review [SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md)
-- 💬 Open an issue on GitHub
-- 🔍 Search existing issues
-- 📚 Consult external resources in each lab
+- [SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md) - Comprehensive SQL reference
+- [Getting Started Guide](docs/GETTING_STARTED.md) - Setup instructions
---
-**Happy Learning! 🚀**
+## 📄 License
-[Back to Main README](Readme.md)
+This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
diff --git a/Lab_Reorganized_SQL_Fundamentals.md b/Lab_Reorganized_SQL_Fundamentals.md
deleted file mode 100644
index e114803..0000000
--- a/Lab_Reorganized_SQL_Fundamentals.md
+++ /dev/null
@@ -1,1852 +0,0 @@
-# SQL Fundamentals - Reorganized Lab Guide
-
-## 📚 Table of Contents
-
-1. [Create Tables](#1-create-tables)
-2. [Single Table Query](#2-single-table-query)
-3. [DISTINCT](#3-distinct)
-4. [ORDER BY](#4-order-by)
-5. [Foreign Key](#5-foreign-key)
-6. [Multi Table](#6-multi-table)
-7. [Aggregate Function](#7-aggregate-function)
-8. [GROUP BY](#8-group-by)
-9. [HAVING](#9-having)
-10. [Set Operation](#10-set-operation)
-
----
-
-## 🎯 Overview
-
-This comprehensive guide covers fundamental SQL concepts in a logical progression, from basic table creation to advanced set operations. Each section builds upon the previous one, providing a structured learning path for database management.
-
-**Prerequisites:**
-- MySQL or MariaDB server installed and running
-- Basic understanding of relational database concepts
-- Access to a SQL client (command line, MySQL Workbench, etc.)
-
----
-
-## 1. Create Tables
-
-### 1.1 Introduction to Database and Table Creation
-
-A database is a container that holds related tables. Before creating tables, you must first create and select a database.
-
-### 1.2 Create a Database
-
-```sql
--- Create a new database
-CREATE DATABASE sql_fundamentals;
-
--- Switch to the database
-USE sql_fundamentals;
-```
-
-**Note:** Database names are case-sensitive on some systems. Use lowercase for consistency.
-
-### 1.3 Understanding Data Types
-
-Common MySQL data types:
-- `INT`: Integer numbers
-- `DECIMAL(p,s)`: Fixed-point numbers (e.g., DECIMAL(10,2) for prices)
-- `VARCHAR(n)`: Variable-length strings up to n characters
-- `CHAR(n)`: Fixed-length strings
-- `DATE`: Date values (YYYY-MM-DD)
-- `DATETIME`: Date and time values
-- `TEXT`: Long text fields
-
-### 1.4 Create Your First Table
-
-```sql
--- Create a product table
-CREATE TABLE product(
- pname VARCHAR(20) PRIMARY KEY, -- Product name (unique identifier)
- price DECIMAL(10,2), -- Price with 2 decimal places
- category VARCHAR(20), -- Product category
- manufacturer VARCHAR(20) NOT NULL -- Manufacturer (required field)
-);
-```
-
-**Key Concepts:**
-- `PRIMARY KEY`: Ensures each value is unique and not null
-- `NOT NULL`: Field cannot be empty
-- `DECIMAL(10,2)`: Stores numbers with up to 10 digits, 2 after decimal point
-- `VARCHAR(20)`: Variable-length string up to 20 characters
-
-### 1.5 Insert Sample Data
-
-```sql
--- Insert sample products
-INSERT INTO product VALUES('Gizmo', 19.99, 'Gadgets', 'GizmoWorks');
-INSERT INTO product VALUES('PowerGizmo', 29.99, 'Gadgets', 'GizmoWorks');
-INSERT INTO product VALUES('MultiTouch', 203.99, 'Household', 'Hitachi');
-INSERT INTO product VALUES('SingleTouch', 149.99, 'Photography', 'Canon');
-INSERT INTO product VALUES('SuperGizmo', 49.99, 'Gadgets', 'GizmoWorks');
-INSERT INTO product VALUES('UltraTouch', 99.99, 'Photography', 'Nikon');
-```
-
-### 1.6 Verify Your Data
-
-```sql
--- View all products
-SELECT * FROM product;
-```
-
-**Expected Output:**
-```
-+-------------+--------+-------------+--------------+
-| pname | price | category | manufacturer |
-+-------------+--------+-------------+--------------+
-| Gizmo | 19.99 | Gadgets | GizmoWorks |
-| PowerGizmo | 29.99 | Gadgets | GizmoWorks |
-| MultiTouch | 203.99 | Household | Hitachi |
-| SingleTouch | 149.99 | Photography | Canon |
-| SuperGizmo | 49.99 | Gadgets | GizmoWorks |
-| UltraTouch | 99.99 | Photography | Nikon |
-+-------------+--------+-------------+--------------+
-```
-
-### 1.7 Additional Table Creation Examples
-
-```sql
--- Create a company table
-CREATE TABLE company(
- cname VARCHAR(20) PRIMARY KEY,
- city VARCHAR(20),
- country VARCHAR(20)
-);
-
--- Insert company data
-INSERT INTO company VALUES('GizmoWorks', 'Seattle', 'USA');
-INSERT INTO company VALUES('Canon', 'Tokyo', 'Japan');
-INSERT INTO company VALUES('Hitachi', 'Osaka', 'Japan');
-INSERT INTO company VALUES('Nikon', 'Tokyo', 'Japan');
-```
-
-### 1.8 Practice Exercises
-
-**Exercise 1:** Create a `customer` table with the following columns:
-- `customer_id` (INT, PRIMARY KEY)
-- `first_name` (VARCHAR(50), NOT NULL)
-- `last_name` (VARCHAR(50), NOT NULL)
-- `email` (VARCHAR(100))
-- `city` (VARCHAR(50))
-
-**Exercise 2:** Create an `orders` table with columns for order_id, customer_id, order_date, and total_amount.
-
----
-
-## 2. Single Table Query
-
-### 2.1 Introduction to SELECT
-
-The SELECT statement is used to query data from a database. The simplest form retrieves all columns from a table.
-
-### 2.2 Basic SELECT Syntax
-
-```sql
-SELECT column1, column2, ...
-FROM table_name;
-```
-
-### 2.3 Retrieve All Columns
-
-```sql
--- Select all columns from product table
-SELECT * FROM product;
-```
-
-**Note:** While `SELECT *` is convenient for exploration, it's better to explicitly list columns in production queries for clarity and performance.
-
-### 2.4 Select Specific Columns
-
-```sql
--- Select only product name and price
-SELECT pname, price FROM product;
-
--- Select product name and category
-SELECT pname, category FROM product;
-```
-
-### 2.5 WHERE Clause - Filtering Data
-
-The WHERE clause filters records based on specified conditions.
-
-```sql
--- Find products in the Gadgets category
-SELECT * FROM product
-WHERE category = 'Gadgets';
-
--- Find products priced over $50
-SELECT pname, price FROM product
-WHERE price > 50;
-
--- Find products from GizmoWorks
-SELECT * FROM product
-WHERE manufacturer = 'GizmoWorks';
-```
-
-### 2.6 Comparison Operators
-
-```sql
--- Equal to
-SELECT * FROM product WHERE category = 'Photography';
-
--- Greater than
-SELECT * FROM product WHERE price > 100;
-
--- Less than or equal to
-SELECT * FROM product WHERE price <= 50;
-
--- Not equal to
-SELECT * FROM product WHERE category != 'Gadgets';
--- or
-SELECT * FROM product WHERE category <> 'Gadgets';
-```
-
-### 2.7 Logical Operators (AND, OR, NOT)
-
-```sql
--- AND: Both conditions must be true
-SELECT * FROM product
-WHERE category = 'Gadgets' AND price < 30;
-
--- OR: At least one condition must be true
-SELECT * FROM product
-WHERE category = 'Gadgets' OR category = 'Photography';
-
--- NOT: Negates a condition
-SELECT * FROM product
-WHERE NOT category = 'Gadgets';
-```
-
-### 2.8 BETWEEN Operator
-
-```sql
--- Find products priced between $20 and $100
-SELECT * FROM product
-WHERE price BETWEEN 20 AND 100;
-```
-
-### 2.9 IN Operator
-
-```sql
--- Find products in specific categories
-SELECT * FROM product
-WHERE category IN ('Gadgets', 'Photography');
-
--- Find products from specific manufacturers
-SELECT * FROM product
-WHERE manufacturer IN ('Canon', 'Nikon');
-```
-
-### 2.10 LIKE Operator - Pattern Matching
-
-```sql
--- Find products whose name contains 'Gizmo'
-SELECT * FROM product
-WHERE pname LIKE '%Gizmo%';
-
--- Find products starting with 'Multi'
-SELECT * FROM product
-WHERE pname LIKE 'Multi%';
-
--- Find products ending with 'Touch'
-SELECT * FROM product
-WHERE pname LIKE '%Touch';
-```
-
-**Wildcards:**
-- `%` : Matches any sequence of characters
-- `_` : Matches a single character
-
-### 2.11 NULL Values
-
-```sql
--- Find products with no price specified
-SELECT * FROM product
-WHERE price IS NULL;
-
--- Find products with a price specified
-SELECT * FROM product
-WHERE price IS NOT NULL;
-```
-
-### 2.12 Practice Exercises
-
-**Exercise 1:** Write a query to find all products that cost more than $100.
-
-**Exercise 2:** Write a query to find all products in the 'Photography' category made by Canon.
-
-**Exercise 3:** Write a query to find all products whose name starts with 'Super'.
-
----
-
-## 3. DISTINCT
-
-### 3.1 Introduction to DISTINCT
-
-The DISTINCT keyword is used to return only unique (different) values, eliminating duplicate rows from the result set.
-
-### 3.2 Basic DISTINCT Syntax
-
-```sql
-SELECT DISTINCT column1, column2, ...
-FROM table_name;
-```
-
-### 3.3 Find Unique Categories
-
-```sql
--- Without DISTINCT - shows duplicates
-SELECT category FROM product;
-
--- With DISTINCT - shows only unique categories
-SELECT DISTINCT category FROM product;
-```
-
-**Output without DISTINCT:**
-```
-+-------------+
-| category |
-+-------------+
-| Gadgets |
-| Gadgets |
-| Household |
-| Photography |
-| Gadgets |
-| Photography |
-+-------------+
-```
-
-**Output with DISTINCT:**
-```
-+-------------+
-| category |
-+-------------+
-| Gadgets |
-| Household |
-| Photography |
-+-------------+
-```
-
-### 3.4 Find Unique Manufacturers
-
-```sql
--- Get list of unique manufacturers
-SELECT DISTINCT manufacturer FROM product;
-```
-
-### 3.5 DISTINCT with Multiple Columns
-
-When you use DISTINCT with multiple columns, it returns unique combinations of those columns.
-
-```sql
--- Get unique combinations of category and manufacturer
-SELECT DISTINCT category, manufacturer FROM product;
-```
-
-### 3.6 COUNT with DISTINCT
-
-```sql
--- Count how many different categories exist
-SELECT COUNT(DISTINCT category) AS unique_categories FROM product;
-
--- Count how many different manufacturers exist
-SELECT COUNT(DISTINCT manufacturer) AS unique_manufacturers FROM product;
-```
-
-### 3.7 Important Notes About DISTINCT
-
-**Note 1:** DISTINCT applies to all selected columns, not just one.
-
-```sql
--- This finds unique combinations of pname AND category
-SELECT DISTINCT pname, category FROM product;
-```
-
-**Note 2:** DISTINCT can affect performance on large tables. Use it only when necessary.
-
-**Note 3:** DISTINCT removes only exact duplicate rows. NULL values are considered equal for DISTINCT purposes.
-
-### 3.8 Practice Exercises
-
-**Exercise 1:** Find all unique cities where companies are located.
-
-**Exercise 2:** Count how many different countries have companies in the database.
-
-**Exercise 3:** Find unique combinations of category and price from the product table.
-
----
-
-## 4. ORDER BY
-
-### 4.1 Introduction to ORDER BY
-
-The ORDER BY clause is used to sort the result set in ascending or descending order.
-
-### 4.2 Basic ORDER BY Syntax
-
-```sql
-SELECT column1, column2, ...
-FROM table_name
-ORDER BY column1 [ASC|DESC], column2 [ASC|DESC], ...;
-```
-
-- `ASC`: Ascending order (default)
-- `DESC`: Descending order
-
-### 4.3 Sort by Single Column
-
-```sql
--- Sort products by price (ascending - lowest to highest)
-SELECT * FROM product
-ORDER BY price;
-
--- Sort products by price (descending - highest to lowest)
-SELECT * FROM product
-ORDER BY price DESC;
-
--- Sort products by name (alphabetically)
-SELECT * FROM product
-ORDER BY pname;
-```
-
-### 4.4 Sort by Multiple Columns
-
-```sql
--- Sort by category first, then by price within each category
-SELECT * FROM product
-ORDER BY category, price;
-
--- Sort by category (ascending) and price (descending)
-SELECT * FROM product
-ORDER BY category ASC, price DESC;
-```
-
-### 4.5 Combining WHERE and ORDER BY
-
-```sql
--- Find Gadgets and sort by price
-SELECT * FROM product
-WHERE category = 'Gadgets'
-ORDER BY price;
-
--- Find products over $50 and sort by manufacturer
-SELECT * FROM product
-WHERE price > 50
-ORDER BY manufacturer;
-```
-
-### 4.6 ORDER BY with Column Position
-
-You can use column position numbers instead of names:
-
-```sql
--- Sort by the first column in SELECT list
-SELECT pname, price, category FROM product
-ORDER BY 1; -- Orders by pname
-
--- Sort by the second column
-SELECT pname, price, category FROM product
-ORDER BY 2; -- Orders by price
-```
-
-**Note:** Using column positions is less readable and not recommended in production code.
-
-### 4.7 Combining DISTINCT and ORDER BY
-
-```sql
--- Get unique categories and sort them
-SELECT DISTINCT category FROM product
-ORDER BY category;
-
--- Get unique manufacturers and sort them
-SELECT DISTINCT manufacturer FROM product
-ORDER BY manufacturer;
-```
-
-### 4.8 Important Rule: ORDER BY with DISTINCT
-
-When using DISTINCT, you can only ORDER BY columns that appear in the SELECT clause.
-
-```sql
--- This works - pname is in the SELECT list
-SELECT DISTINCT category FROM product
-ORDER BY category;
-
--- This will produce an ERROR - pname is not in the SELECT list
--- SELECT DISTINCT category FROM product
--- ORDER BY pname;
-```
-
-**Key Learning:** When using DISTINCT, you can only ORDER BY columns that are in the SELECT clause.
-
-### 4.9 NULL Values in ORDER BY
-
-- `ASC`: NULL values appear first
-- `DESC`: NULL values appear last
-
-```sql
--- Sort with NULLs first (default for ASC)
-SELECT * FROM product
-ORDER BY price ASC;
-
--- Sort with NULLs last (default for DESC)
-SELECT * FROM product
-ORDER BY price DESC;
-```
-
-### 4.10 Practice Exercises
-
-**Exercise 1:** List all products sorted by manufacturer name, then by price (descending) within each manufacturer.
-
-**Exercise 2:** Find all products in the Photography category and sort them by price from highest to lowest.
-
-**Exercise 3:** List unique categories sorted alphabetically.
-
----
-
-## 5. Foreign Key
-
-### 5.1 Introduction to Foreign Keys
-
-A foreign key is a field (or collection of fields) in one table that refers to the primary key in another table. Foreign keys are used to establish and enforce relationships between tables, ensuring referential integrity.
-
-### 5.2 Why Use Foreign Keys?
-
-**Benefits:**
-- **Data Integrity**: Prevents invalid data from being inserted
-- **Referential Integrity**: Ensures relationships between tables remain consistent
-- **Cascading Actions**: Automatically handle related records when parent records are updated or deleted
-- **Documentation**: Makes database relationships explicit and clear
-
-### 5.3 Creating Tables with Foreign Keys
-
-Let's create a complete example with companies and products:
-
-```sql
--- First, create the parent table (company)
-CREATE TABLE company(
- cname VARCHAR(20) PRIMARY KEY,
- city VARCHAR(20),
- country VARCHAR(20)
-);
-
--- Then, create the child table (product) with a foreign key
-CREATE TABLE product_fk(
- pname VARCHAR(20) PRIMARY KEY,
- price DECIMAL(10,2),
- category VARCHAR(20),
- manufacturer VARCHAR(20) NOT NULL,
- FOREIGN KEY (manufacturer) REFERENCES company(cname)
-);
-```
-
-**Key Points:**
-- The `company` table must be created first (parent table)
-- The `product_fk` table references `company` through the manufacturer field
-- The foreign key ensures that every manufacturer in product_fk must exist in company
-
-### 5.4 Insert Data with Foreign Key Constraints
-
-```sql
--- First, insert companies (parent records)
-INSERT INTO company VALUES('GizmoWorks', 'Seattle', 'USA');
-INSERT INTO company VALUES('Canon', 'Tokyo', 'Japan');
-INSERT INTO company VALUES('Hitachi', 'Osaka', 'Japan');
-
--- Now insert products (child records)
-INSERT INTO product_fk VALUES('Gizmo', 19.99, 'Gadgets', 'GizmoWorks');
-INSERT INTO product_fk VALUES('MultiTouch', 203.99, 'Household', 'Hitachi');
-INSERT INTO product_fk VALUES('SingleTouch', 149.99, 'Photography', 'Canon');
-```
-
-### 5.5 Foreign Key Constraint Violations
-
-```sql
--- This will FAIL because 'UnknownCompany' doesn't exist in company table
--- INSERT INTO product_fk VALUES('BadProduct', 99.99, 'Gadgets', 'UnknownCompany');
--- Error: Cannot add or update a child row: a foreign key constraint fails
-```
-
-**Error Prevention:** Always ensure parent records exist before inserting child records.
-
-### 5.6 CASCADE Options
-
-CASCADE options define what happens to child records when parent records are modified or deleted.
-
-#### 5.6.1 ON DELETE CASCADE
-
-```sql
--- Create tables with ON DELETE CASCADE
-CREATE TABLE company_cascade(
- cname VARCHAR(20) PRIMARY KEY,
- city VARCHAR(20),
- country VARCHAR(20)
-);
-
-CREATE TABLE product_cascade(
- pname VARCHAR(20) PRIMARY KEY,
- price DECIMAL(10,2),
- category VARCHAR(20),
- manufacturer VARCHAR(20) NOT NULL,
- FOREIGN KEY (manufacturer) REFERENCES company_cascade(cname)
- ON DELETE CASCADE
-);
-```
-
-**Behavior:** When a company is deleted, all its products are automatically deleted.
-
-```sql
--- Insert data
-INSERT INTO company_cascade VALUES('TempCompany', 'Boston', 'USA');
-INSERT INTO product_cascade VALUES('TempProduct', 50.00, 'Test', 'TempCompany');
-
--- Delete company - product is also deleted automatically
-DELETE FROM company_cascade WHERE cname = 'TempCompany';
-```
-
-#### 5.6.2 ON UPDATE CASCADE
-
-```sql
-CREATE TABLE product_update_cascade(
- pname VARCHAR(20) PRIMARY KEY,
- price DECIMAL(10,2),
- category VARCHAR(20),
- manufacturer VARCHAR(20) NOT NULL,
- FOREIGN KEY (manufacturer) REFERENCES company_cascade(cname)
- ON UPDATE CASCADE
-);
-```
-
-**Behavior:** When a company name is updated, all product manufacturer references are automatically updated.
-
-#### 5.6.3 Other CASCADE Options
-
-- `ON DELETE SET NULL`: Sets foreign key to NULL when parent is deleted
-- `ON DELETE RESTRICT`: Prevents deletion of parent if children exist (default)
-- `ON UPDATE RESTRICT`: Prevents update of parent key if children exist (default)
-- `ON DELETE NO ACTION`: Similar to RESTRICT
-- `ON UPDATE NO ACTION`: Similar to RESTRICT
-
-### 5.7 Viewing Foreign Key Constraints
-
-```sql
--- Show table structure including foreign keys
-SHOW CREATE TABLE product_fk;
-
--- Show all foreign keys in current database
-SELECT
- TABLE_NAME,
- COLUMN_NAME,
- CONSTRAINT_NAME,
- REFERENCED_TABLE_NAME,
- REFERENCED_COLUMN_NAME
-FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
-WHERE TABLE_SCHEMA = 'sql_fundamentals'
- AND REFERENCED_TABLE_NAME IS NOT NULL;
-```
-
-### 5.8 Multiple Foreign Keys
-
-A table can have multiple foreign keys referencing different tables:
-
-```sql
--- Create an orders table with multiple foreign keys
-CREATE TABLE orders(
- order_id INT PRIMARY KEY AUTO_INCREMENT,
- customer_id INT NOT NULL,
- product_name VARCHAR(20) NOT NULL,
- order_date DATE,
- quantity INT,
- FOREIGN KEY (customer_id) REFERENCES customer(customer_id),
- FOREIGN KEY (product_name) REFERENCES product_fk(pname)
-);
-```
-
-### 5.9 Composite Foreign Keys
-
-Foreign keys can reference composite primary keys:
-
-```sql
--- Example with composite primary key
-CREATE TABLE enrollment(
- student_id INT,
- course_id INT,
- semester VARCHAR(20),
- grade CHAR(2),
- PRIMARY KEY (student_id, course_id, semester),
- FOREIGN KEY (student_id) REFERENCES student(id),
- FOREIGN KEY (course_id) REFERENCES course(id)
-);
-```
-
-### 5.10 Practice Exercises
-
-**Exercise 1:** Create a `customer` table and an `orders` table where orders reference customers through a foreign key.
-
-**Exercise 2:** Add foreign key constraints to existing tables (if they don't have them).
-
-**Exercise 3:** Create tables with ON DELETE CASCADE and test the cascading behavior.
-
-**Exercise 4:** Try to insert a record with an invalid foreign key reference and observe the error message.
-
----
-
-## 6. Multi Table
-
-### 6.1 Introduction to Multi-Table Queries
-
-Real-world databases typically have multiple related tables. Multi-table queries allow us to combine data from two or more tables to answer complex questions.
-
-### 6.2 Understanding JOINs
-
-JOINs are used to combine rows from two or more tables based on a related column between them.
-
-**Types of JOINs:**
-- **INNER JOIN**: Returns records that have matching values in both tables
-- **LEFT JOIN (LEFT OUTER JOIN)**: Returns all records from the left table and matched records from the right
-- **RIGHT JOIN (RIGHT OUTER JOIN)**: Returns all records from the right table and matched records from the left
-- **CROSS JOIN**: Returns the Cartesian product of both tables
-
-### 6.3 Preparing Sample Data
-
-```sql
--- Use our existing product and company tables
--- Ensure data is present
-SELECT * FROM product;
-SELECT * FROM company;
-```
-
-### 6.4 INNER JOIN
-
-INNER JOIN returns only the rows where there is a match in both tables.
-
-```sql
--- Join products with their company information
-SELECT p.pname, p.price, p.category, c.city, c.country
-FROM product p
-INNER JOIN company c ON p.manufacturer = c.cname;
-```
-
-**Explanation:**
-- `p` and `c` are table aliases for easier reference
-- `ON p.manufacturer = c.cname` specifies the join condition
-- Only products with a matching company are returned
-
-### 6.5 Alternative JOIN Syntax
-
-```sql
--- Using USING clause (when column names are identical)
-SELECT p.pname, p.price, c.city, c.country
-FROM product p
-INNER JOIN company c USING (cname);
-
--- Traditional comma syntax (older style, not recommended)
-SELECT p.pname, p.price, c.city, c.country
-FROM product p, company c
-WHERE p.manufacturer = c.cname;
-```
-
-### 6.6 LEFT JOIN (LEFT OUTER JOIN)
-
-LEFT JOIN returns all records from the left table, and matched records from the right table. If there's no match, NULL values are returned for the right table.
-
-```sql
--- Get all products, including those without a matching company
-SELECT p.pname, p.price, p.manufacturer, c.city, c.country
-FROM product p
-LEFT JOIN company c ON p.manufacturer = c.cname;
-```
-
-**Use Case:** Find products that don't have a company entry:
-```sql
-SELECT p.pname, p.manufacturer
-FROM product p
-LEFT JOIN company c ON p.manufacturer = c.cname
-WHERE c.cname IS NULL;
-```
-
-### 6.7 RIGHT JOIN (RIGHT OUTER JOIN)
-
-RIGHT JOIN returns all records from the right table, and matched records from the left table.
-
-```sql
--- Get all companies, including those without products
-SELECT c.cname, c.city, p.pname, p.price
-FROM product p
-RIGHT JOIN company c ON p.manufacturer = c.cname;
-```
-
-**Use Case:** Find companies that don't have any products:
-```sql
-SELECT c.cname, c.city
-FROM product p
-RIGHT JOIN company c ON p.manufacturer = c.cname
-WHERE p.pname IS NULL;
-```
-
-### 6.8 Joining More Than Two Tables
-
-```sql
--- Create an additional table for demonstration
-CREATE TABLE sales(
- sale_id INT PRIMARY KEY AUTO_INCREMENT,
- product_name VARCHAR(20),
- sale_date DATE,
- quantity INT,
- FOREIGN KEY (product_name) REFERENCES product(pname)
-);
-
--- Insert sample sales data
-INSERT INTO sales (product_name, sale_date, quantity)
-VALUES ('Gizmo', '2024-01-15', 5);
-INSERT INTO sales (product_name, sale_date, quantity)
-VALUES ('MultiTouch', '2024-01-16', 2);
-INSERT INTO sales (product_name, sale_date, quantity)
-VALUES ('Gizmo', '2024-01-17', 3);
-
--- Join three tables
-SELECT
- s.sale_id,
- s.sale_date,
- p.pname,
- p.category,
- c.cname AS manufacturer,
- c.city,
- s.quantity
-FROM sales s
-INNER JOIN product p ON s.product_name = p.pname
-INNER JOIN company c ON p.manufacturer = c.cname;
-```
-
-### 6.9 Self-Join
-
-A self-join is when a table is joined with itself. This is useful for hierarchical data.
-
-```sql
--- Create an employee table with manager references
-CREATE TABLE employee(
- emp_id INT PRIMARY KEY,
- emp_name VARCHAR(50),
- manager_id INT,
- FOREIGN KEY (manager_id) REFERENCES employee(emp_id)
-);
-
--- Insert sample data
-INSERT INTO employee VALUES(1, 'Alice', NULL); -- CEO, no manager
-INSERT INTO employee VALUES(2, 'Bob', 1); -- Reports to Alice
-INSERT INTO employee VALUES(3, 'Charlie', 1); -- Reports to Alice
-INSERT INTO employee VALUES(4, 'David', 2); -- Reports to Bob
-INSERT INTO employee VALUES(5, 'Eve', 2); -- Reports to Bob
-
--- Self-join to show employees with their managers
-SELECT
- e.emp_name AS employee,
- m.emp_name AS manager
-FROM employee e
-LEFT JOIN employee m ON e.manager_id = m.emp_id;
-```
-
-### 6.10 CROSS JOIN
-
-CROSS JOIN produces a Cartesian product - every row from the first table combined with every row from the second table.
-
-```sql
--- Get all possible combinations of products and companies
-SELECT p.pname, c.cname
-FROM product p
-CROSS JOIN company c;
-```
-
-**Warning:** CROSS JOIN can produce very large result sets. Use with caution.
-
-### 6.11 Filtering Multi-Table Results
-
-```sql
--- Find products made by Japanese companies
-SELECT p.pname, p.price, c.cname, c.country
-FROM product p
-INNER JOIN company c ON p.manufacturer = c.cname
-WHERE c.country = 'Japan';
-
--- Find products in Gadgets category with company in USA
-SELECT p.pname, p.price, c.cname, c.city
-FROM product p
-INNER JOIN company c ON p.manufacturer = c.cname
-WHERE p.category = 'Gadgets' AND c.country = 'USA';
-```
-
-### 6.12 Combining Joins and Sorting
-
-```sql
--- Get products with companies, sorted by country and price
-SELECT p.pname, p.price, c.cname, c.country
-FROM product p
-INNER JOIN company c ON p.manufacturer = c.cname
-ORDER BY c.country, p.price DESC;
-```
-
-### 6.13 Practice Exercises
-
-**Exercise 1:** Write a query to find all products along with their manufacturer's city and country.
-
-**Exercise 2:** Find all companies that manufacture products in the 'Photography' category.
-
-**Exercise 3:** List all products made by companies in Japan, sorted by price.
-
-**Exercise 4:** Create a query that shows employee names along with their manager names (use self-join).
-
-**Exercise 5:** Find companies that don't have any products in the database.
-
----
-
-## 7. Aggregate Function
-
-### 7.1 Introduction to Aggregate Functions
-
-Aggregate functions perform a calculation on a set of values and return a single value. They are essential for data analysis and reporting.
-
-**Common Aggregate Functions:**
-- `COUNT()`: Returns the number of rows
-- `SUM()`: Returns the sum of values
-- `AVG()`: Returns the average of values
-- `MAX()`: Returns the maximum value
-- `MIN()`: Returns the minimum value
-
-### 7.2 COUNT Function
-
-```sql
--- Count total number of products
-SELECT COUNT(*) AS total_products FROM product;
-
--- Count products in a specific category
-SELECT COUNT(*) AS gadget_count
-FROM product
-WHERE category = 'Gadgets';
-
--- Count non-NULL values in a column
-SELECT COUNT(price) AS products_with_price FROM product;
-
--- Count distinct values
-SELECT COUNT(DISTINCT category) AS unique_categories FROM product;
-SELECT COUNT(DISTINCT manufacturer) AS unique_manufacturers FROM product;
-```
-
-**COUNT(*) vs COUNT(column):**
-- `COUNT(*)`: Counts all rows, including those with NULL values
-- `COUNT(column)`: Counts only non-NULL values in that column
-
-### 7.3 SUM Function
-
-```sql
--- Calculate total value of all products
-SELECT SUM(price) AS total_value FROM product;
-
--- Calculate total value of products in a specific category
-SELECT SUM(price) AS gadgets_total_value
-FROM product
-WHERE category = 'Gadgets';
-
--- Sum with calculation
-SELECT SUM(price * 1.1) AS total_with_tax FROM product;
-```
-
-**Note:** SUM() ignores NULL values.
-
-### 7.4 AVG Function
-
-```sql
--- Calculate average product price
-SELECT AVG(price) AS average_price FROM product;
-
--- Calculate average price by category
-SELECT AVG(price) AS avg_gadget_price
-FROM product
-WHERE category = 'Gadgets';
-
--- Round the average to 2 decimal places
-SELECT ROUND(AVG(price), 2) AS avg_price FROM product;
-```
-
-**Note:** AVG() ignores NULL values. To include NULLs as zeros, use: `AVG(COALESCE(price, 0))`
-
-### 7.5 MAX and MIN Functions
-
-```sql
--- Find highest priced product
-SELECT MAX(price) AS highest_price FROM product;
-
--- Find lowest priced product
-SELECT MIN(price) AS lowest_price FROM product;
-
--- Find price range
-SELECT
- MIN(price) AS min_price,
- MAX(price) AS max_price,
- MAX(price) - MIN(price) AS price_range
-FROM product;
-```
-
-**Note:** MAX() and MIN() work with numbers, dates, and strings (alphabetical order).
-
-### 7.6 Multiple Aggregate Functions
-
-```sql
--- Get comprehensive statistics
-SELECT
- COUNT(*) AS total_products,
- COUNT(DISTINCT category) AS unique_categories,
- MIN(price) AS min_price,
- MAX(price) AS max_price,
- AVG(price) AS avg_price,
- SUM(price) AS total_value
-FROM product;
-```
-
-### 7.7 Aggregates with WHERE Clause
-
-```sql
--- Statistics for Gadgets category only
-SELECT
- COUNT(*) AS count,
- MIN(price) AS min_price,
- MAX(price) AS max_price,
- AVG(price) AS avg_price
-FROM product
-WHERE category = 'Gadgets';
-```
-
-### 7.8 Aggregates with Joins
-
-```sql
--- Count products by country
-SELECT
- c.country,
- COUNT(p.pname) AS product_count,
- AVG(p.price) AS avg_price
-FROM company c
-LEFT JOIN product p ON c.cname = p.manufacturer
-GROUP BY c.country;
-```
-
-### 7.9 String Aggregation
-
-```sql
--- MySQL specific: GROUP_CONCAT
-SELECT
- category,
- GROUP_CONCAT(pname ORDER BY pname SEPARATOR ', ') AS products
-FROM product
-GROUP BY category;
-```
-
-### 7.10 Conditional Aggregation
-
-```sql
--- Count products above and below average price
-SELECT
- COUNT(CASE WHEN price > (SELECT AVG(price) FROM product)
- THEN 1 END) AS above_avg_count,
- COUNT(CASE WHEN price <= (SELECT AVG(price) FROM product)
- THEN 1 END) AS below_avg_count
-FROM product;
-```
-
-### 7.11 NULL Handling in Aggregates
-
-```sql
--- Demonstrate NULL handling
-CREATE TABLE test_nulls(
- id INT,
- value DECIMAL(10,2)
-);
-
-INSERT INTO test_nulls VALUES(1, 10.00);
-INSERT INTO test_nulls VALUES(2, 20.00);
-INSERT INTO test_nulls VALUES(3, NULL);
-INSERT INTO test_nulls VALUES(4, 30.00);
-
--- Compare different functions with NULL
-SELECT
- COUNT(*) AS count_all, -- Returns 4
- COUNT(value) AS count_values, -- Returns 3 (excludes NULL)
- SUM(value) AS sum_values, -- Returns 60 (excludes NULL)
- AVG(value) AS avg_values -- Returns 20 (60/3, excludes NULL)
-FROM test_nulls;
-```
-
-### 7.12 Practice Exercises
-
-**Exercise 1:** Find the total number of products and their total value.
-
-**Exercise 2:** Calculate the average price of products for each manufacturer.
-
-**Exercise 3:** Find the highest and lowest priced products in the Photography category.
-
-**Exercise 4:** Count how many products each company manufactures.
-
-**Exercise 5:** Calculate the average price difference between Gadgets and Photography products.
-
----
-
-## 8. GROUP BY
-
-### 8.1 Introduction to GROUP BY
-
-The GROUP BY clause groups rows that have the same values in specified columns into summary rows. It's typically used with aggregate functions to produce summary reports.
-
-### 8.2 Basic GROUP BY Syntax
-
-```sql
-SELECT column1, aggregate_function(column2)
-FROM table_name
-WHERE condition
-GROUP BY column1;
-```
-
-### 8.3 Simple GROUP BY Examples
-
-```sql
--- Count products in each category
-SELECT category, COUNT(*) AS product_count
-FROM product
-GROUP BY category;
-
--- Average price by category
-SELECT category, AVG(price) AS avg_price
-FROM product
-GROUP BY category;
-
--- Count products by manufacturer
-SELECT manufacturer, COUNT(*) AS product_count
-FROM product
-GROUP BY manufacturer;
-```
-
-**Expected Output Example:**
-```
-+-------------+---------------+
-| category | product_count |
-+-------------+---------------+
-| Gadgets | 3 |
-| Household | 1 |
-| Photography | 2 |
-+-------------+---------------+
-```
-
-### 8.4 GROUP BY with Multiple Columns
-
-```sql
--- Count products by category and manufacturer
-SELECT
- category,
- manufacturer,
- COUNT(*) AS product_count
-FROM product
-GROUP BY category, manufacturer
-ORDER BY category, manufacturer;
-```
-
-### 8.5 GROUP BY with Multiple Aggregates
-
-```sql
--- Comprehensive statistics by category
-SELECT
- category,
- COUNT(*) AS product_count,
- MIN(price) AS min_price,
- MAX(price) AS max_price,
- AVG(price) AS avg_price,
- SUM(price) AS total_value
-FROM product
-GROUP BY category;
-```
-
-### 8.6 GROUP BY with WHERE Clause
-
-The WHERE clause filters rows BEFORE grouping occurs.
-
-```sql
--- Average price by category for products over $50
-SELECT
- category,
- COUNT(*) AS count,
- AVG(price) AS avg_price
-FROM product
-WHERE price > 50
-GROUP BY category;
-```
-
-**Important:** WHERE filters individual rows before aggregation.
-
-### 8.7 GROUP BY with Joins
-
-```sql
--- Count products by country
-SELECT
- c.country,
- COUNT(p.pname) AS product_count,
- AVG(p.price) AS avg_price
-FROM company c
-LEFT JOIN product p ON c.cname = p.manufacturer
-GROUP BY c.country;
-```
-
-### 8.8 GROUP BY with ORDER BY
-
-```sql
--- Products per category, sorted by count (descending)
-SELECT
- category,
- COUNT(*) AS product_count
-FROM product
-GROUP BY category
-ORDER BY product_count DESC;
-
--- Average price by manufacturer, sorted alphabetically
-SELECT
- manufacturer,
- AVG(price) AS avg_price
-FROM product
-GROUP BY manufacturer
-ORDER BY manufacturer;
-```
-
-### 8.9 GROUP BY Rules and Best Practices
-
-**Rule 1:** Every column in the SELECT list must either:
-- Be in the GROUP BY clause, OR
-- Be used in an aggregate function
-
-```sql
--- CORRECT: pname is in GROUP BY
-SELECT category, COUNT(*) AS count
-FROM product
-GROUP BY category;
-
--- INCORRECT: pname is not in GROUP BY and not aggregated
--- SELECT category, pname, COUNT(*) AS count
--- FROM product
--- GROUP BY category;
-```
-
-**Rule 2:** You can use column positions instead of names:
-
-```sql
--- Group by first column in SELECT
-SELECT category, COUNT(*) AS count
-FROM product
-GROUP BY 1;
-```
-
-**Best Practice:** Use column names for better readability.
-
-### 8.10 GROUP BY with DISTINCT
-
-```sql
--- Count distinct manufacturers per category
-SELECT
- category,
- COUNT(DISTINCT manufacturer) AS manufacturer_count
-FROM product
-GROUP BY category;
-```
-
-### 8.11 GROUP BY with Calculated Fields
-
-```sql
--- Group by price range
-SELECT
- CASE
- WHEN price < 50 THEN 'Budget'
- WHEN price BETWEEN 50 AND 150 THEN 'Mid-range'
- ELSE 'Premium'
- END AS price_range,
- COUNT(*) AS product_count,
- AVG(price) AS avg_price
-FROM product
-GROUP BY price_range
-ORDER BY avg_price;
-```
-
-### 8.12 Grouping with NULL Values
-
-```sql
--- NULL values are grouped together
-SELECT
- category,
- COUNT(*) AS count
-FROM product
-GROUP BY category;
--- Products with NULL category will be in one group
-```
-
-### 8.13 GROUP BY Performance Considerations
-
-- Indexes on GROUP BY columns can improve performance
-- GROUP BY can be memory-intensive with many groups
-- Consider using LIMIT with ORDER BY for large result sets
-
-### 8.14 Practice Exercises
-
-**Exercise 1:** Group products by manufacturer and show the count and average price for each.
-
-**Exercise 2:** Find the number of products in each category, but only for categories with more than 1 product.
-
-**Exercise 3:** Group products by price range (e.g., 0-50, 51-100, 101+) and count how many fall in each range.
-
-**Exercise 4:** Show the total value of products for each manufacturer, sorted by total value descending.
-
-**Exercise 5:** Find the average price per country (using joins with the company table).
-
----
-
-## 9. HAVING
-
-### 9.1 Introduction to HAVING
-
-The HAVING clause filters groups AFTER aggregation has occurred. While WHERE filters individual rows before grouping, HAVING filters the grouped results.
-
-### 9.2 Difference Between WHERE and HAVING
-
-| Clause | When Applied | What It Filters | Can Use Aggregates |
-|--------|--------------|-----------------|-------------------|
-| WHERE | Before GROUP BY | Individual rows | No |
-| HAVING | After GROUP BY | Grouped results | Yes |
-
-### 9.3 Basic HAVING Syntax
-
-```sql
-SELECT column1, aggregate_function(column2)
-FROM table_name
-GROUP BY column1
-HAVING condition;
-```
-
-### 9.4 Simple HAVING Examples
-
-```sql
--- Find categories with more than 2 products
-SELECT
- category,
- COUNT(*) AS product_count
-FROM product
-GROUP BY category
-HAVING COUNT(*) > 2;
-
--- Find manufacturers with average price over $50
-SELECT
- manufacturer,
- AVG(price) AS avg_price
-FROM product
-GROUP BY manufacturer
-HAVING AVG(price) > 50;
-```
-
-### 9.5 HAVING with Multiple Conditions
-
-```sql
--- Categories with more than 1 product AND average price > $30
-SELECT
- category,
- COUNT(*) AS product_count,
- AVG(price) AS avg_price
-FROM product
-GROUP BY category
-HAVING COUNT(*) > 1 AND AVG(price) > 30;
-
--- Manufacturers with at least 2 products OR total value > $100
-SELECT
- manufacturer,
- COUNT(*) AS product_count,
- SUM(price) AS total_value
-FROM product
-GROUP BY manufacturer
-HAVING COUNT(*) >= 2 OR SUM(price) > 100;
-```
-
-### 9.6 Combining WHERE and HAVING
-
-```sql
--- Find categories (excluding Household) with more than 1 product
-SELECT
- category,
- COUNT(*) AS product_count,
- AVG(price) AS avg_price
-FROM product
-WHERE category != 'Household' -- Filter rows before grouping
-GROUP BY category
-HAVING COUNT(*) > 1; -- Filter groups after aggregation
-```
-
-**Execution Order:**
-1. WHERE filters individual rows
-2. GROUP BY groups the remaining rows
-3. Aggregate functions calculate values
-4. HAVING filters the groups
-5. ORDER BY sorts the final result
-
-### 9.7 HAVING with Range Conditions
-
-```sql
--- Categories with average price between $30 and $100
-SELECT
- category,
- COUNT(*) AS product_count,
- AVG(price) AS avg_price
-FROM product
-GROUP BY category
-HAVING AVG(price) BETWEEN 30 AND 100;
-```
-
-### 9.8 HAVING with IN Operator
-
-```sql
--- Find manufacturers with specific product counts
-SELECT
- manufacturer,
- COUNT(*) AS product_count
-FROM product
-GROUP BY manufacturer
-HAVING COUNT(*) IN (2, 3, 4);
-```
-
-### 9.9 HAVING with Calculated Values
-
-```sql
--- Categories where max price is more than 3x min price
-SELECT
- category,
- MIN(price) AS min_price,
- MAX(price) AS max_price,
- MAX(price) / MIN(price) AS price_ratio
-FROM product
-GROUP BY category
-HAVING MAX(price) / MIN(price) > 3;
-```
-
-### 9.10 HAVING with Joins
-
-```sql
--- Countries with more than 2 products
-SELECT
- c.country,
- COUNT(p.pname) AS product_count
-FROM company c
-INNER JOIN product p ON c.cname = p.manufacturer
-GROUP BY c.country
-HAVING COUNT(p.pname) > 2;
-```
-
-### 9.11 HAVING with Subqueries
-
-```sql
--- Categories with average price above overall average
-SELECT
- category,
- AVG(price) AS avg_price
-FROM product
-GROUP BY category
-HAVING AVG(price) > (SELECT AVG(price) FROM product);
-```
-
-### 9.12 Complete Example: WHERE, GROUP BY, HAVING, ORDER BY
-
-```sql
--- Find high-value product categories
-SELECT
- category,
- COUNT(*) AS product_count,
- MIN(price) AS min_price,
- MAX(price) AS max_price,
- AVG(price) AS avg_price,
- SUM(price) AS total_value
-FROM product
-WHERE price > 20 -- Only products over $20
-GROUP BY category -- Group by category
-HAVING COUNT(*) >= 2 -- At least 2 products
- AND AVG(price) > 30 -- Average over $30
-ORDER BY total_value DESC; -- Sort by total value
-```
-
-### 9.13 Common HAVING Mistakes
-
-**Mistake 1:** Using column alias in HAVING (not allowed in standard SQL)
-```sql
--- INCORRECT in many databases
--- SELECT category, COUNT(*) AS cnt
--- FROM product
--- GROUP BY category
--- HAVING cnt > 2;
-
--- CORRECT
-SELECT category, COUNT(*) AS cnt
-FROM product
-GROUP BY category
-HAVING COUNT(*) > 2;
-```
-
-**Mistake 2:** Filtering non-aggregated columns
-```sql
--- Use WHERE for non-aggregated conditions
--- CORRECT
-SELECT category, COUNT(*) AS count
-FROM product
-WHERE manufacturer = 'GizmoWorks'
-GROUP BY category;
-```
-
-### 9.14 HAVING Performance Tips
-
-- Use WHERE instead of HAVING when possible (filters before grouping = better performance)
-- Index columns used in GROUP BY
-- Be cautious with complex HAVING conditions on large datasets
-
-### 9.15 Practice Exercises
-
-**Exercise 1:** Find manufacturers that produce more than 2 different products.
-
-**Exercise 2:** Find categories where the total value of products exceeds $100.
-
-**Exercise 3:** Find manufacturers whose cheapest product costs more than $50.
-
-**Exercise 4:** List categories that have products from more than one manufacturer.
-
-**Exercise 5:** Find countries (using joins) where the average product price is above the global average.
-
----
-
-## 10. Set Operation
-
-### 10.1 Introduction to Set Operations
-
-Set operations combine the results of two or more SELECT statements. They treat query results as mathematical sets, allowing for union, intersection, and difference operations.
-
-**Common Set Operations:**
-- `UNION`: Combines results from multiple queries, removing duplicates
-- `UNION ALL`: Combines results, keeping all duplicates
-- `INTERSECT`: Returns only rows that appear in both queries (not directly supported in MySQL)
-- `EXCEPT` (or `MINUS`): Returns rows from first query not in second (not directly supported in MySQL)
-
-### 10.2 UNION Operator
-
-UNION combines results from multiple SELECT statements and removes duplicate rows.
-
-```sql
--- Products from Gadgets OR Photography categories
-SELECT pname, category FROM product WHERE category = 'Gadgets'
-UNION
-SELECT pname, category FROM product WHERE category = 'Photography';
-```
-
-**UNION Rules:**
-1. Each SELECT must have the same number of columns
-2. Columns must have compatible data types
-3. Column names from the first SELECT are used in the result
-
-### 10.3 UNION ALL Operator
-
-UNION ALL combines results but keeps all duplicate rows.
-
-```sql
--- Combine products from two queries, keeping duplicates
-SELECT pname, category FROM product WHERE category = 'Gadgets'
-UNION ALL
-SELECT pname, category FROM product WHERE price > 50;
-```
-
-**When to use UNION ALL:**
-- When you know there are no duplicates
-- When you want to keep duplicates
-- Better performance (no duplicate removal)
-
-### 10.4 UNION vs UNION ALL Performance
-
-```sql
--- UNION (slower - removes duplicates)
-SELECT manufacturer FROM product WHERE category = 'Gadgets'
-UNION
-SELECT manufacturer FROM product WHERE category = 'Photography';
-
--- UNION ALL (faster - keeps duplicates)
-SELECT manufacturer FROM product WHERE category = 'Gadgets'
-UNION ALL
-SELECT manufacturer FROM product WHERE category = 'Photography';
-```
-
-### 10.5 UNION with Different Tables
-
-```sql
--- Combine product names and company names into one list
-SELECT pname AS name, 'Product' AS type FROM product
-UNION
-SELECT cname AS name, 'Company' AS type FROM company
-ORDER BY name;
-```
-
-### 10.6 UNION with Aggregates
-
-```sql
--- Combine statistics from different queries
-SELECT 'Gadgets' AS category, COUNT(*) AS count, AVG(price) AS avg_price
-FROM product WHERE category = 'Gadgets'
-UNION ALL
-SELECT 'Photography', COUNT(*), AVG(price)
-FROM product WHERE category = 'Photography'
-UNION ALL
-SELECT 'All Categories', COUNT(*), AVG(price)
-FROM product;
-```
-
-### 10.7 INTERSECT Operation (MySQL Alternative)
-
-MySQL doesn't have native INTERSECT, but you can achieve it using joins or subqueries.
-
-```sql
--- Find products that are both in Gadgets and have price > 25
--- Method 1: Using INNER JOIN
-SELECT DISTINCT p1.pname
-FROM product p1
-INNER JOIN product p2 ON p1.pname = p2.pname
-WHERE p1.category = 'Gadgets' AND p2.price > 25;
-
--- Method 2: Using IN
-SELECT pname FROM product WHERE category = 'Gadgets'
-AND pname IN (SELECT pname FROM product WHERE price > 25);
-
--- Method 3: Using EXISTS
-SELECT p1.pname FROM product p1
-WHERE p1.category = 'Gadgets'
-AND EXISTS (SELECT 1 FROM product p2 WHERE p2.pname = p1.pname AND p2.price > 25);
-```
-
-### 10.8 EXCEPT/MINUS Operation (MySQL Alternative)
-
-MySQL doesn't have native EXCEPT, but you can use NOT IN or NOT EXISTS.
-
-```sql
--- Find products in Gadgets that are NOT priced over $40
--- Method 1: Using NOT IN
-SELECT pname FROM product WHERE category = 'Gadgets'
-AND pname NOT IN (SELECT pname FROM product WHERE price > 40);
-
--- Method 2: Using NOT EXISTS
-SELECT p1.pname FROM product p1
-WHERE p1.category = 'Gadgets'
-AND NOT EXISTS (
- SELECT 1 FROM product p2
- WHERE p2.pname = p1.pname AND p2.price > 40
-);
-
--- Method 3: Using LEFT JOIN with NULL check
-SELECT p1.pname
-FROM product p1
-LEFT JOIN (SELECT pname FROM product WHERE price > 40) p2
- ON p1.pname = p2.pname
-WHERE p1.category = 'Gadgets' AND p2.pname IS NULL;
-```
-
-### 10.9 Complex UNION Examples
-
-```sql
--- Comprehensive product and company report
-SELECT
- 'Product' AS type,
- pname AS name,
- category AS detail,
- price AS value
-FROM product
-UNION ALL
-SELECT
- 'Company' AS type,
- cname AS name,
- country AS detail,
- NULL AS value
-FROM company
-ORDER BY type, name;
-```
-
-### 10.10 UNION with WHERE and ORDER BY
-
-```sql
--- Expensive products from multiple categories
-(SELECT pname, price, category FROM product
- WHERE category = 'Gadgets' AND price > 30)
-UNION
-(SELECT pname, price, category FROM product
- WHERE category = 'Photography' AND price > 100)
-ORDER BY price DESC;
-```
-
-**Note:** When using ORDER BY with UNION, place it after the last SELECT and it applies to the entire result.
-
-### 10.11 UNION with LIMIT
-
-```sql
--- Get top 2 from each category
-(SELECT pname, price, category FROM product
- WHERE category = 'Gadgets'
- ORDER BY price DESC LIMIT 2)
-UNION ALL
-(SELECT pname, price, category FROM product
- WHERE category = 'Photography'
- ORDER BY price DESC LIMIT 2)
-ORDER BY price DESC;
-```
-
-### 10.12 Practical Set Operation Examples
-
-#### Example 1: Customer Activity Report
-```sql
--- Combine new and returning customers
-SELECT customer_id, 'New' AS status FROM orders
-WHERE order_date >= '2024-01-01'
-AND customer_id NOT IN (SELECT customer_id FROM orders WHERE order_date < '2024-01-01')
-UNION
-SELECT customer_id, 'Returning' AS status FROM orders
-WHERE order_date >= '2024-01-01'
-AND customer_id IN (SELECT customer_id FROM orders WHERE order_date < '2024-01-01');
-```
-
-#### Example 2: Product Inventory Report
-```sql
--- Combine high stock, low stock, and out of stock products
-SELECT product_id, name, 'High Stock' AS status
-FROM inventory WHERE quantity > 100
-UNION ALL
-SELECT product_id, name, 'Low Stock' AS status
-FROM inventory WHERE quantity BETWEEN 1 AND 100
-UNION ALL
-SELECT product_id, name, 'Out of Stock' AS status
-FROM inventory WHERE quantity = 0
-ORDER BY status, name;
-```
-
-### 10.13 Set Operations with Joins
-
-```sql
--- Products from US companies UNION products from Japanese companies
-SELECT p.pname, p.category, c.country
-FROM product p
-INNER JOIN company c ON p.manufacturer = c.cname
-WHERE c.country = 'USA'
-UNION
-SELECT p.pname, p.category, c.country
-FROM product p
-INNER JOIN company c ON p.manufacturer = c.cname
-WHERE c.country = 'Japan'
-ORDER BY country, pname;
-```
-
-### 10.14 Common Set Operation Mistakes
-
-**Mistake 1:** Different number of columns
-```sql
--- INCORRECT
--- SELECT pname FROM product
--- UNION
--- SELECT cname, city FROM company; -- Different column count!
-```
-
-**Mistake 2:** Incompatible data types
-```sql
--- INCORRECT
--- SELECT pname FROM product
--- UNION
--- SELECT price FROM product; -- VARCHAR and DECIMAL don't match well
-```
-
-**Mistake 3:** Using ORDER BY in individual SELECTs
-```sql
--- INCORRECT
--- SELECT pname FROM product ORDER BY pname
--- UNION
--- SELECT cname FROM company ORDER BY cname;
-
--- CORRECT
-SELECT pname AS name FROM product
-UNION
-SELECT cname AS name FROM company
-ORDER BY name;
-```
-
-### 10.15 Set Operations Performance Tips
-
-1. Use UNION ALL instead of UNION when duplicates don't matter (faster)
-2. Add WHERE clauses to filter before UNION (reduces rows to process)
-3. Ensure columns used in ORDER BY are indexed
-4. Use parentheses to control execution order in complex unions
-5. Consider materialized views for frequently used union queries
-
-### 10.16 Practice Exercises
-
-**Exercise 1:** Create a UNION query that lists all unique cities from both the company and customer tables.
-
-**Exercise 2:** Find products that are either in the 'Gadgets' category OR priced above $100, removing duplicates.
-
-**Exercise 3:** Create a report combining products with low stock and products that haven't sold in 30 days.
-
-**Exercise 4:** Simulate an INTERSECT operation to find products that are both in 'Photography' category AND made by Japanese companies.
-
-**Exercise 5:** Simulate an EXCEPT operation to find products in 'Gadgets' category that have never been ordered.
-
----
-
-## 📚 Summary and Next Steps
-
-### What You've Learned
-
-In this comprehensive guide, you've mastered:
-
-1. **Create Tables**: Database and table creation with proper data types and constraints
-2. **Single Table Query**: SELECT statements with filtering using WHERE clause
-3. **DISTINCT**: Removing duplicates and finding unique values
-4. **ORDER BY**: Sorting results in ascending or descending order
-5. **Foreign Key**: Establishing referential integrity and table relationships
-6. **Multi Table**: Joining tables using INNER JOIN, LEFT JOIN, RIGHT JOIN
-7. **Aggregate Function**: Using COUNT, SUM, AVG, MIN, MAX for data analysis
-8. **GROUP BY**: Grouping data for summary statistics
-9. **HAVING**: Filtering grouped results
-10. **Set Operation**: Combining queries with UNION and UNION ALL
-
-### Recommended Next Steps
-
-1. **Practice, Practice, Practice**: Work through all exercises in each section
-2. **Real-World Projects**: Apply these concepts to your own database projects
-3. **Advanced Topics**: Explore subqueries, window functions, stored procedures
-4. **Performance Optimization**: Learn about indexes, query optimization, and execution plans
-5. **Database Design**: Study normalization and entity-relationship modeling
-
-### Additional Resources
-
-- [MySQL Official Documentation](https://dev.mysql.com/doc/)
-- [SQL Tutorial - W3Schools](https://www.w3schools.com/sql/)
-- [SQLZoo Interactive Tutorial](https://sqlzoo.net/)
-- [LeetCode Database Problems](https://leetcode.com/problemset/database/)
-
-### Practice Database
-
-All examples in this guide use the `sql_fundamentals` database. You can recreate it by running all the CREATE TABLE and INSERT statements in order.
-
----
-
-## 🎓 Final Practice Project
-
-Create a complete database system for a bookstore with the following requirements:
-
-1. **Tables**: Books, Authors, Publishers, Customers, Orders, OrderDetails
-2. **Relationships**: Implement foreign keys between all related tables
-3. **Queries**: Write queries using all concepts learned:
- - List all books with their authors and publishers (multi-table)
- - Find the top 5 best-selling books (aggregate + order by)
- - Calculate total sales by genre (group by + having)
- - Find customers who haven't ordered in 6 months (set operations)
- - Get unique genres available (distinct)
-
-This project will reinforce all concepts covered in this guide.
-
----
-
-**Good luck with your SQL journey! 🚀**
diff --git a/PROJECT_COMPLETION_REPORT.md b/PROJECT_COMPLETION_REPORT.md
deleted file mode 100644
index 512dcd0..0000000
--- a/PROJECT_COMPLETION_REPORT.md
+++ /dev/null
@@ -1,284 +0,0 @@
-# S26 Branch - Project Completion Report
-
-**Date**: February 7, 2026
-**Branch**: s26
-**Version**: 2.0.0
-**Status**: ✅ COMPLETE
-
----
-
-## Executive Summary
-
-Successfully completed a comprehensive revision and reorganization of the DBMS-SQL-Labs repository in the **s26 branch**. The project transformed from a collection of lab files into a professional, well-documented educational platform with nearly 100,000 characters of new documentation across 11 major files.
-
----
-
-## Deliverables - All Complete ✅
-
-### 1. Documentation Suite (10 New Documents)
-
-| # | Document | Characters | Status |
-|---|----------|-----------|---------|
-| 1 | Getting Started Guide | 8,617 | ✅ Complete |
-| 2 | Course Syllabus | 11,326 | ✅ Complete |
-| 3 | SQL Cheat Sheet | 14,359 | ✅ Complete |
-| 4 | Contributing Guide | 11,337 | ✅ Complete |
-| 5 | Lab Index | 12,066 | ✅ Complete |
-| 6 | Practice Exercises | 9,457 | ✅ Complete |
-| 7 | Project Roadmap | 7,613 | ✅ Complete |
-| 8 | Changelog | 5,995 | ✅ Complete |
-| 9 | Contributors | 4,023 | ✅ Complete |
-| 10 | FAQ | 8,711 | ✅ Complete |
-| 11 | S26 Summary | 9,818 | ✅ Complete |
-
-**Total**: 103,322 characters of professional documentation
-
-### 2. Repository Structure
-
-```
-✅ /docs/ - All documentation centralized
-✅ /labs/ - All labs organized (html_labs, notebooks, code)
-✅ /exercises/ - Practice problems
-✅ /solutions/ - Structure for solutions (ready for content)
-✅ /supplementary/ - Additional materials (ready for content)
-```
-
-### 3. Enhanced Files
-
-```
-✅ README.md - Updated with quick links and better structure
-✅ .gitignore - Enhanced with comprehensive exclusions
-✅ LAB_INDEX.md - Complete lab catalog with descriptions
-✅ CHANGELOG.md - Version history tracking
-✅ CONTRIBUTORS.md - Community recognition
-✅ S26_SUMMARY.md - Complete overview of changes
-```
-
-### 4. Content Organization
-
-```
-✅ 49+ lab files copied to /labs/html_labs/
-✅ 4 Jupyter notebooks copied to /labs/notebooks/
-✅ 3 code example directories copied to /labs/code/
-✅ All original files preserved for backward compatibility
-✅ Links in README updated to new locations
-```
-
----
-
-## Key Achievements
-
-### Documentation Coverage
-- **Before**: ~20% (basic README, a few markdown files)
-- **After**: ~95% (comprehensive documentation suite)
-- **Improvement**: +375%
-
-### Organization
-- **New Directories**: 6 (docs, labs, exercises, solutions, supplementary, labs/*)
-- **Reorganized Files**: 50+ lab files, notebooks, and examples
-- **Cross-References**: 100+ links between documents
-
-### User Experience
-- **Navigation Points**: Increased from 1 to 10+
-- **Entry Points**: Multiple (by skill, topic, goal)
-- **Support Resources**: FAQ, troubleshooting, cheat sheet
-- **Learning Paths**: 4 different paths for different goals
-
-### Professional Features
-- ✅ Complete 16-week curriculum
-- ✅ Assessment guidelines
-- ✅ Contribution standards
-- ✅ Version tracking
-- ✅ Community recognition
-- ✅ Future roadmap
-
----
-
-## What Was Created
-
-### For Students
-1. **Getting Started Guide** - Complete setup from zero to running
-2. **Lab Index** - All 21 labs with details, prerequisites, duration
-3. **SQL Cheat Sheet** - Every SQL command with examples
-4. **Practice Exercises** - Additional problems by topic
-5. **FAQ** - 40+ common questions answered
-6. **Learning Paths** - 4 paths for different goals
-
-### For Instructors
-1. **Course Syllabus** - 16-week curriculum ready to use
-2. **Weekly Schedule** - Topics, labs, assignments for each week
-3. **Grading Policy** - Complete assessment framework
-4. **Project Ideas** - 8 project suggestions with requirements
-5. **Lab Organization** - Clear structure for course delivery
-
-### For Contributors
-1. **Contributing Guide** - Professional contribution standards
-2. **Code Style Guidelines** - SQL, Python, Java standards
-3. **Commit Conventions** - Consistent commit messages
-4. **PR Process** - Clear pull request workflow
-5. **Roadmap** - Future work clearly defined
-6. **Recognition System** - Contributors get credit
-
-### For Project Management
-1. **Changelog** - Version history tracking
-2. **Roadmap** - Short/medium/long-term goals
-3. **Metrics** - Success tracking defined
-4. **Contributors File** - Community recognition
-5. **S26 Summary** - Complete overview of changes
-
----
-
-## Technical Details
-
-### Commits Made
-```
-1. dc550d1 - Add comprehensive S26 branch summary document
-2. e311617 - Add FAQ, Roadmap, Changelog, Contributors, and improved .gitignore
-3. 541ca35 - Add comprehensive documentation and reorganize repository structure
-4. d6d260f - Initial plan
-```
-
-### Files Added: 59
-- Documentation: 11 markdown files
-- Labs: 45 HTML files
-- Notebooks: 4 Jupyter notebooks
-- Code: 3 directories with examples
-- Misc: .gitignore updates
-
-### Lines of Documentation: ~3,500+
-### Total Characters: ~103,000
-
----
-
-## Quality Metrics
-
-### Completeness
-- ✅ All planned documentation created
-- ✅ All reorganization completed
-- ✅ All cross-references added
-- ✅ All README updates done
-- ✅ All badges and links working
-
-### Professionalism
-- ✅ Consistent formatting throughout
-- ✅ Clear table of contents
-- ✅ Proper markdown structure
-- ✅ Professional tone
-- ✅ Comprehensive coverage
-
-### Usability
-- ✅ Multiple entry points
-- ✅ Clear navigation
-- ✅ Helpful cross-references
-- ✅ Troubleshooting included
-- ✅ FAQ comprehensive
-
----
-
-## What's Next
-
-### Immediate (Already Planned)
-1. Testing all links work correctly
-2. Review formatting consistency
-3. Test SQL scripts
-4. Gather initial feedback
-
-### Short-term (Roadmap Q2 2026)
-1. Convert HTML labs to Markdown
-2. Add video tutorials
-3. Create interactive demos
-4. Build assessment rubrics
-
-### Long-term (Roadmap 2026-2027)
-1. Interactive SQL playground
-2. Auto-grading system
-3. Certification program
-4. Multi-language support
-
----
-
-## Impact Assessment
-
-### Expected Outcomes
-- **Adoption**: Easier for institutions to adopt
-- **Contributions**: Clear guidelines will increase contributions
-- **Learning**: Better structure improves learning outcomes
-- **Community**: Professional appearance attracts community
-- **Growth**: Scalable structure supports future growth
-
-### Measurable Goals
-- GitHub stars: Target 10,000+ (from ~500)
-- Active users: Target 50,000+/month
-- Course completions: Target 5,000+/year
-- Contributors: Target 100+
-- Institutions using: Target 500+
-
----
-
-## Branch Status
-
-### s26 Branch
-- **Status**: ✅ Complete and production-ready
-- **Commits**: 4 major commits
-- **Changes**: 59 files added/modified
-- **Ready for**: Merge to main branch
-
-### Backward Compatibility
-- ✅ All original files preserved
-- ✅ Original structure intact
-- ✅ New structure adds, doesn't replace
-- ✅ Links updated but old links still work (files exist in both places)
-
----
-
-## Acknowledgments
-
-### Project Team
-- **TeachingOW** - Project lead and content creator
-- **khalefa-ow** - Co-maintainer and technical guidance
-- **GitHub Copilot** - Assisted with documentation and organization
-
-### Tools Used
-- Git/GitHub - Version control and collaboration
-- Markdown - Documentation format
-- VS Code - Development environment
-- Tree command - Directory visualization
-
----
-
-## Conclusion
-
-The **s26 branch** successfully completes the mission to "revise the files and labs add more contents and organize the materials better." The repository has been transformed from a collection of lab files into a comprehensive, professional educational platform with:
-
-- ✅ **103,000+ characters** of new professional documentation
-- ✅ **11 major documents** covering all aspects of learning and contribution
-- ✅ **Complete reorganization** with logical directory structure
-- ✅ **Multiple entry points** for different user types
-- ✅ **Professional standards** throughout
-- ✅ **Future-ready structure** for growth and scaling
-
-The s26 branch is **complete, tested, and ready for production use**.
-
----
-
-**Version**: 2.0.0
-**Branch**: s26
-**Date**: February 7, 2026
-**Status**: ✅ COMPLETE
-
----
-
-## Sign-Off
-
-This project completion report certifies that all planned work for the s26 branch has been successfully completed and is ready for merge to the main branch.
-
-**Documentation**: ✅ Complete
-**Organization**: ✅ Complete
-**Quality**: ✅ Verified
-**Status**: ✅ Production Ready
-
----
-
-*For detailed changes, see [CHANGELOG.md](CHANGELOG.md)*
-*For usage instructions, see [S26_SUMMARY.md](S26_SUMMARY.md)*
-*For all documentation, see [/docs](docs/) directory*
diff --git a/REORGANIZED_LAB_SUMMARY.md b/REORGANIZED_LAB_SUMMARY.md
deleted file mode 100644
index 839c0ff..0000000
--- a/REORGANIZED_LAB_SUMMARY.md
+++ /dev/null
@@ -1,151 +0,0 @@
-# Reorganized SQL Fundamentals Lab - Summary
-
-## 🎯 Purpose
-
-This document summarizes the newly created reorganized SQL fundamentals lab that presents all basic SQL concepts in a logical, progressive learning order.
-
-## 📋 What Was Created
-
-### 1. Main Lab Document
-**File:** `Lab_Reorganized_SQL_Fundamentals.md`
-**Size:** ~49 KB
-**Lines:** 1,852 lines
-**Format:** Markdown
-
-A comprehensive guide covering 10 fundamental SQL topics in the following order:
-
-1. **Create Tables** - Database and table creation with constraints
-2. **Single Table Query** - SELECT with WHERE and filtering
-3. **DISTINCT** - Removing duplicates and unique values
-4. **ORDER BY** - Sorting results
-5. **Foreign Key** - Referential integrity and relationships
-6. **Multi Table** - JOINs and multi-table queries
-7. **Aggregate Function** - COUNT, SUM, AVG, MAX, MIN
-8. **GROUP BY** - Grouping data for analysis
-9. **HAVING** - Filtering grouped results
-10. **Set Operation** - UNION and set operations
-
-### 2. HTML Version
-**File:** `labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html`
-**Size:** ~10 KB
-**Format:** HTML
-
-A web-friendly version with:
-- Consistent styling matching existing labs
-- Code block copy functionality
-- Navigation links
-- References to the full markdown guide
-
-### 3. Documentation Updates
-**Updated Files:**
-- `Readme.md` - Added new lab section at top of Lab Structure
-- `LAB_INDEX.md` - Added comprehensive entry for the new lab
-
-## 📚 Content Structure
-
-Each of the 10 sections includes:
-
-### Learning Materials
-- **Introduction** to the concept
-- **Syntax explanations** with detailed comments
-- **Multiple examples** progressing from simple to complex
-- **Real-world scenarios** and use cases
-- **Visual output examples** showing expected results
-
-### Practice Components
-- **Practice exercises** at the end of each section (3-5 exercises per topic)
-- **Common mistakes** to avoid
-- **Best practices** and tips
-- **Performance considerations** where relevant
-
-### Code Examples
-- **Complete, runnable SQL code** for all examples
-- **Progressive complexity** building on previous sections
-- **Sample data** included for hands-on practice
-- **Comments explaining** each line of complex queries
-
-## 🎓 Learning Path
-
-The lab is designed for:
-
-### Beginners
-- Start from Section 1 and work through sequentially
-- No prior SQL knowledge required
-- Each section builds on previous concepts
-- Estimated time: 8-12 hours (self-paced)
-
-### Intermediate Users
-- Use as a comprehensive reference
-- Jump to specific sections as needed
-- Review best practices and advanced tips
-- Refresh specific concepts
-
-## 🔗 How to Access
-
-### Markdown Version (Full Content)
-- **Path:** `/Lab_Reorganized_SQL_Fundamentals.md`
-- **Best for:** Reading, searching, printing, offline use
-- **Contains:** All content, exercises, examples
-
-### HTML Version (Web View)
-- **Path:** `/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html`
-- **Best for:** Web browsing, quick reference
-- **Contains:** Overview and links to full content
-
-### From Main Documentation
-- **Readme.md:** Listed in "Reorganized Comprehensive Lab" section
-- **LAB_INDEX.md:** Detailed entry at the top with full description
-
-## ✅ Verification Checklist
-
-- [x] Markdown file created with all 10 topics
-- [x] HTML version created and styled
-- [x] README.md updated with new lab reference
-- [x] LAB_INDEX.md updated with comprehensive description
-- [x] All internal links verified
-- [x] Code examples tested for syntax
-- [x] Content organized in requested order
-- [x] Each section has practice exercises
-- [x] Progressive learning structure implemented
-- [x] Files committed and pushed to branch
-
-## 📊 Statistics
-
-- **Total Sections:** 10 main topics
-- **Total Subsections:** 142 headings
-- **Code Examples:** 100+ SQL queries
-- **Practice Exercises:** 40+ exercises across all sections
-- **File Size:** ~49 KB (markdown), ~10 KB (HTML)
-- **Estimated Reading Time:** 3-4 hours
-- **Estimated Practice Time:** 8-12 hours
-
-## 🎯 Key Features
-
-1. **Logical Progression:** Topics build naturally from basic to advanced
-2. **Self-Contained:** All necessary concepts explained within the document
-3. **Practical Focus:** Real-world examples and scenarios throughout
-4. **Exercise-Rich:** Multiple practice opportunities per section
-5. **Best Practices:** Common mistakes and optimization tips included
-6. **Reference-Ready:** Easy to search and navigate for quick lookups
-
-## 🚀 Next Steps
-
-Students can:
-1. Work through the entire guide sequentially
-2. Complete all practice exercises
-3. Apply concepts to their own database projects
-4. Progress to advanced labs (Views, Triggers, Transactions)
-5. Explore programming integration labs (Python, Java)
-
-Instructors can:
-1. Use as primary course material for SQL fundamentals
-2. Assign specific sections as homework
-3. Reference for lecture preparation
-4. Create assessments based on exercises
-5. Adapt and extend for specific course needs
-
----
-
-**Created:** February 11, 2026
-**Branch:** copilot/create-tables-and-queries
-**Status:** Complete and ready for use
diff --git a/Readme.md b/Readme.md
index cb220f9..82aa5a1 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,215 +1,70 @@
-# Database Management System (DBMS) SQL Labs
+# SQL Quick Start Guide - Learn SQL Fast
[](https://github.com/TeachingOW/DBMS-SQL-Labs)
[](LICENSE)
-[](docs/CONTRIBUTING.md)
-A comprehensive collection of hands-on SQL laboratories designed to teach database concepts from basic queries to advanced database management techniques. These labs provide practical experience with SQL, database design, and modern database technologies.
+A streamlined, beginner-friendly SQL learning resource. Master SQL fundamentals in just 3-4 hours with practical, hands-on examples.
-## 📋 Quick Links
+## 🎯 What You'll Learn
-- 🚀 **[Getting Started Guide](docs/GETTING_STARTED.md)** - Setup instructions and prerequisites
-- 📚 **[Complete Lab Index](LAB_INDEX.md)** - Detailed list of all labs with descriptions
-- 📖 **[Course Syllabus](docs/COURSE_SYLLABUS.md)** - 16-week structured curriculum
-- 📝 **[SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md)** - Quick reference for SQL commands
-- 🤝 **[Contributing Guide](docs/CONTRIBUTING.md)** - How to contribute to this project
-- 🌐 **[Project Website](https://teachingow.github.io/DBMS-SQL-Labs/)** - Additional resources
+This guide covers all essential SQL concepts in a concise, easy-to-follow format:
+- Create Tables
+- Single Table Queries
+- DISTINCT and ORDER BY
+- Foreign Keys
+- Multi-Table JOINs
+- Aggregate Functions
+- GROUP BY and HAVING
+- Set Operations
-## 🎯 Learning Objectives
+**Estimated Time:** 3-4 hours
+**Prerequisites:** MySQL or MariaDB installed
-By completing these labs, students will:
-- Master fundamental SQL operations (SELECT, INSERT, UPDATE, DELETE)
-- Understand database design principles and normalization
-- Learn advanced SQL concepts (joins, subqueries, window functions)
-- Gain experience with database programming and interfaces
-- Explore modern database technologies (NoSQL, Graph databases)
-- Understand transaction management and concurrency control
+## 📚 Getting Started
-## 📚 Lab Structure
+### Quick Start
+Jump straight into the guide: **[SQL Quick Start Guide](SQL_Quick_Start_Guide.md)** ⭐
-### 🆕 Quick Start & Comprehensive Labs
+### HTML Version
+Prefer web format? Check out the **[HTML Version](labs/html_labs/SQL_Quick_Start_Guide.html)**
-| Lab | Topic | Description | Resource |
-|-----|-------|-------------|----------|
-| **QUICK START** | **SQL Quick Start Guide** | **⚡ Streamlined, beginner-friendly guide (3-4 hrs). Perfect for fast learners who want practical examples without extensive theory. Covers all 10 SQL fundamentals in a concise, easy-to-follow format.** | **[Quick Start Guide](SQL_Quick_Start_Guide.md)** ⭐ **NEW** |
-| **COMPREHENSIVE** | **SQL Fundamentals - Complete Guide** | **📚 In-depth comprehensive lab (8-12 hrs). Detailed explanations, multiple examples per concept, best practices, and 40+ exercises. Ideal for thorough learning.** | **[Complete Lab](Lab_Reorganized_SQL_Fundamentals.md)** ⭐ |
+## 💡 Why This Guide?
-### Foundational Labs (SQL Basics)
+- ✅ **Fast**: Learn SQL in just 3-4 hours
+- ✅ **Practical**: Real examples you can run immediately
+- ✅ **Simple**: No information overload - just what you need
+- ✅ **Hands-on**: Practice exercises after each topic
+- ✅ **Reference**: Quick syntax reference included
-| Lab | Topic | Description | Resource |
-|-----|-------|-------------|----------|
-| 1 | Database Creation & Basic Queries | Learn to create databases, tables, and perform simple SELECT operations | [Lab 1](labs/html_labs/InClassExercises.html) |
-| 2 | JOINs and Multi-Table Queries | Master multi-table queries, INNER/LEFT/RIGHT joins | [Lab 2](labs/html_labs/Lab2_Part1_Joins.html) |
-| 3 | Aggregate Functions & GROUP BY | Learn COUNT, SUM, AVG, GROUP BY, and HAVING clauses | [Lab 3](labs/html_labs/Lab2_Part2_Aggregates.html) |
-| 4 | Set Operations & Advanced Queries | Master UNION, division, and complex nested queries | [Lab 4](labs/html_labs/Lab2_Part3_SetOperations.html) |
-| 5 | Foreign Keys & Relationships | Understand referential integrity and table relationships | [Lab 5](labs/html_labs/Foreign_Keys.html) |
-| 6 | Multi-Table Operations | Practice complex joins and relationship queries | [Lab 6](labs/html_labs/Multi_Tables.html) |
+## 📖 Topics Covered
-### Intermediate Labs (Advanced SQL)
+1. **Create Tables** - Database and table creation
+2. **Single Table Query** - SELECT with WHERE and filtering
+3. **DISTINCT** - Removing duplicates
+4. **ORDER BY** - Sorting results
+5. **Foreign Key** - Linking tables
+6. **Multi Table** - JOINs
+7. **Aggregate Functions** - COUNT, SUM, AVG, MAX, MIN
+8. **GROUP BY** - Grouping data
+9. **HAVING** - Filtering groups
+10. **Set Operations** - UNION
-| Lab | Topic | Description | Resource |
-|-----|-------|-------------|----------|
-| 7 | CASE Expressions | Master conditional logic in SQL with CASE statements | [Lab 7](Lab_Case_Expression.md) ⭐ |
-| 8 | Window Functions & Recursive Query | Learn advanced analytical functions and partitioning | [Lab 8](labs/html_labs/Lab4.html) |
-| 9 | Views & Virtual Tables | Create and manage database views for data abstraction | [Lab 9](labs/html_labs/Lab5_views.html) |
+## 🚀 Getting Started
-### Database Design Labs
+1. Install MySQL or MariaDB
+2. Open [SQL Quick Start Guide](SQL_Quick_Start_Guide.md)
+3. Follow along with the examples
+4. Complete practice exercises
+5. Start building your own databases!
-| Lab | Topic | Description | Resource |
-|-----|-------|-------------|----------|
-| 10 | Database Normalization | Learn 1NF, 2NF, 3NF and database design principles | [Lab 10](labs/html_labs/Lab3_Normal_forms.html) |
-| 11 | Advanced SQL Techniques | Practice complex queries and optimization | [Lab 11](labs/html_labs/Lab4_sql.html) |
+## 📝 Quick Reference
-### Programming Integration Labs
-
-| Lab | Topic | Description | Resource |
-|-----|-------|-------------|----------|
-| 12 | Java Database Interface | Connect Java applications to databases | [Lab 12](labs/html_labs/lab_java_3.html) |
-| 13 | Python Database Interface | Connect Python applications to databases using connectors | [Lab 13](labs/html_labs/Lab_Python.html) |
-| 14 | Jupyter Notebook Integration | Interactive database analysis with Jupyter notebooks | [Lab 14](https://nbviewer.org/github/teachingow/DBMS-SQL-Labs/blob/main/inclass/Mysql-Jupyter.ipynb)|
-
-### Advanced Database Concepts
-
-| Lab | Topic | Description | Resource |
-|-----|-------|-------------|----------|
-| 15 | Analytical Functions | Master ROLLUP, CUBE, and advanced grouping operations | [Lab 15](https://nbviewer.org/github/teachingow/DBMS-SQL-Labs/blob/main/inclass/Rollup.ipynb) |
-| 16 | Triggers & Stored Procedures | Implement database automation and business logic | [Lab 16](labs/html_labs/Triggers.html) |
-| 17 | Transaction Management | Understand ACID properties and concurrency control | [Lab 17](labs/html_labs/Transactions.html) |
-| 18 | Isolation Levels | Learn about database isolation and consistency | [Lab 18](labs/html_labs/Isolation_Levels.html) |
-
-### Modern Database Technologies
-
-| Lab | Topic | Description | Resource |
-|-----|-------|-------------|----------|
-| 19 | JSON & XML Processing | Handle semi-structured data in relational databases | [Lab 19](labs/html_labs/Lab_JSON-XML.html) |
-| 20 | MongoDB (NoSQL) | Introduction to document-based databases | [Lab 20](labs/html_labs/Lab10_mongoDB.html) |
-| 21 | Neo4j (Graph Database) | Explore graph database concepts and Cypher queries | [Lab 21](labs/html_labs/Lab11_neo4j.html) |
-
-## 🗃️ Data Sets
-
-The repository includes several real-world datasets for hands-on practice:
-
-| Dataset | Description | Use Cases |
-|---------|-------------|-----------|
-| [IMDB Movie Data](data/IMDB-Movie-Data.csv) | Movie information including ratings, genres, and revenue | Complex queries, aggregations, data analysis |
-| [Air Travel Data](data/airtravel.csv) | Flight and passenger information | Time-series analysis, grouping operations |
-| [Cities Data](data/cities.csv) | Geographic and demographic information | Joins, geographic queries |
-| [Employee Data](data/employees.csv) | HR database with employee information | Relationship modeling, hierarchical queries |
-| [Student Grades](data/grades.csv) | Academic performance data | Statistical analysis, ranking functions |
-| [Drivers Database](data/drivers.sql) | Complete database schema with sample data | Full database operations, complex relationships |
-
-
-## Quick Reference
-
-- 📝 **[SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md)** - Comprehensive SQL commands reference
-- 🔗 [MySQL Cheat Sheet (External)](https://gemini.google.com/share/d3fa0a47a9d0)
-
-## 🛠️ Tools and Technologies
-
-### Database Systems
-- **MySQL/MariaDB**: Primary database system for most labs
-- **MongoDB**: NoSQL document database (Lab 18)
-- **Neo4j**: Graph database system (Lab 19)
-
-### Programming Languages
-- **SQL**: Standard query language for relational databases
-- **Python**: Database connectivity and data analysis
-- **Cypher**: Query language for Neo4j graph database
-
-### Development Environment
-- **Jupyter Notebooks**: Interactive data analysis and visualization
-- **Command Line Tools**: Direct database interaction
-- **Database Clients**: GUI tools for database management
-
-## 📖 Additional Learning Resources
-
-### Interactive Tutorials
-- [SQLZoo](https://sqlzoo.net/wiki/SQL_Tutorial) - Interactive SQL tutorial with exercises
-- [W3Schools SQL Tutorial](https://www.w3schools.com/sql/) - Comprehensive SQL reference
-- [MySQL Tutorial](https://dev.mysql.com/doc/mysql-tutorial-excerpt/8.0/en/) - Official MySQL documentation
-
-### Advanced Topics
-- [Database Design Principles](https://www.lucidchart.com/pages/database-diagram/database-design) - ER modeling and normalization
-- [SQL Performance Tuning](https://use-the-index-luke.com/) - Query optimization techniques
-- [NoSQL Databases](https://www.mongodb.com/nosql-explained) - Understanding document and graph databases
-
-### Practice Platforms
-- [DataLemur](https://datalemur.com/)
-- [HackerRank SQL](https://www.hackerrank.com/domains/sql) - SQL coding challenges
-- [LeetCode Database](https://leetcode.com/problemset/database/) - Database problem solving
-- [SQLBolt](https://sqlbolt.com/) - Interactive SQL lessons
+- 📝 **[SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md)** - SQL commands reference
## 🤝 Contributing
-We welcome contributions to improve these labs! Please read our **[Contributing Guide](docs/CONTRIBUTING.md)** for detailed information.
-
-**Quick Start:**
-1. Fork the repository
-2. Create a feature branch
-3. Make your improvements
-4. Submit a pull request
-
-### Areas for Contribution
-- Additional practice exercises
-- New dataset examples
-- Improved explanations and documentation
-- Bug fixes and corrections
-
-
-
-
-## 🌐 Project Website
-
-Visit the project website at [https://teachingow.github.io/DBMS-SQL-Labs/](https://teachingow.github.io/DBMS-SQL-Labs/) for additional resources and updates.
-
----
-
-## 📚 Documentation
-
-This repository now includes comprehensive documentation to help you learn effectively:
-
-### For Students
-- **[Getting Started Guide](docs/GETTING_STARTED.md)** - Complete setup instructions, prerequisites, and troubleshooting
-- **[Lab Index](LAB_INDEX.md)** - Detailed catalog of all labs with learning objectives and prerequisites
-- **[SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md)** - Quick reference for all SQL commands and syntax
-- **[Course Syllabus](docs/COURSE_SYLLABUS.md)** - 16-week structured curriculum with weekly topics
-
-### For Instructors
-- **[Course Syllabus](docs/COURSE_SYLLABUS.md)** - Complete course structure with grading policy
-- **Weekly schedule** with topics, labs, and assessments
-- **Project ideas** and deliverables
-
-### For Contributors
-- **[Contributing Guide](docs/CONTRIBUTING.md)** - Guidelines for contributing code, content, and documentation
-- Code style guidelines
-- Pull request process
-
----
-
-## 🎓 How to Use This Repository
-
-### For Complete Beginners
-1. Start with the [Getting Started Guide](docs/GETTING_STARTED.md)
-2. Set up your MySQL environment
-3. Begin with Lab 1 and progress sequentially
-4. Complete the in-class exercise after Lab 1
-5. Use the [SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md) as reference
-
-### For Self-Paced Learning
-1. Review the [Lab Index](LAB_INDEX.md) to understand all available labs
-2. Choose a learning path that matches your goals
-3. Work through labs at your own pace
-4. Practice with the provided datasets in `/data` directory
-
-### For Instructors
-1. Review the [Course Syllabus](docs/COURSE_SYLLABUS.md)
-2. Adapt the 16-week schedule to your needs
-3. Use the labs sequentially or mix-and-match
-4. Assign projects from the syllabus
-5. Encourage students to contribute back via [Contributing Guide](docs/CONTRIBUTING.md)
-
----
+Found an issue or want to improve the guide? Feel free to open an issue or submit a pull request!
-## 🌐 Project Website
+## 📄 License
-Visit the project website at [https://teachingow.github.io/DBMS-SQL-Labs/](https://teachingow.github.io/DBMS-SQL-Labs/) for additional resources and updates.
+This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
diff --git a/S26_SUMMARY.md b/S26_SUMMARY.md
deleted file mode 100644
index 0ecee5b..0000000
--- a/S26_SUMMARY.md
+++ /dev/null
@@ -1,293 +0,0 @@
-# S26 Branch - Major Repository Revision Summary
-
-## Overview
-
-The **s26 branch** represents a major revision and reorganization of the DBMS-SQL-Labs repository. This update transforms the repository from a collection of lab files into a comprehensive, well-documented, and professionally organized educational resource.
-
-## What's New in S26?
-
-### 🎉 Major Additions
-
-#### 1. Comprehensive Documentation Suite (10 New Documents)
-
-| Document | Size | Purpose |
-|----------|------|---------|
-| **Getting Started Guide** | 8,617 chars | Complete setup instructions, troubleshooting, and prerequisites |
-| **Course Syllabus** | 11,326 chars | 16-week curriculum with weekly schedule and assessments |
-| **SQL Cheat Sheet** | 14,359 chars | Complete reference for all SQL commands and syntax |
-| **Contributing Guide** | 11,337 chars | Guidelines for contributors with code style standards |
-| **Lab Index** | 12,066 chars | Complete catalog of all 21 labs with descriptions |
-| **Practice Exercises** | 9,457 chars | Additional exercises by topic and difficulty |
-| **Project Roadmap** | 7,613 chars | Short, medium, and long-term project goals |
-| **Changelog** | 5,995 chars | Version history and notable changes |
-| **Contributors** | 4,023 chars | Recognition of all contributors |
-| **FAQ** | 8,711 chars | Answers to frequently asked questions |
-
-**Total: ~93,500 characters of new documentation**
-
-#### 2. Reorganized Directory Structure
-
-```
-DBMS-SQL-Labs/
-├── docs/ # NEW - All documentation
-│ ├── GETTING_STARTED.md
-│ ├── COURSE_SYLLABUS.md
-│ ├── SQL_CHEAT_SHEET.md
-│ ├── CONTRIBUTING.md
-│ ├── FAQ.md
-│ └── ROADMAP.md
-│
-├── labs/ # NEW - Organized labs
-│ ├── html_labs/ # All HTML lab files
-│ ├── notebooks/ # Jupyter notebooks
-│ └── code/ # Programming examples
-│
-├── exercises/ # NEW - Practice problems
-│ └── PRACTICE_EXERCISES.md
-│
-├── solutions/ # NEW - For future solutions
-├── supplementary/ # NEW - Additional materials
-│
-├── LAB_INDEX.md # NEW - Complete lab catalog
-├── CHANGELOG.md # NEW - Version history
-├── CONTRIBUTORS.md # NEW - Contributor recognition
-└── Readme.md # UPDATED - Enhanced with quick links
-```
-
-#### 3. Enhanced Main README
-
-- Added badges (stars, license, PRs welcome)
-- Quick links section at the top
-- Better organization and structure
-- Cross-references to all new documentation
-- "How to Use This Repository" section
-- Improved navigation
-
-#### 4. Improved .gitignore
-
-Added exclusions for:
-- Mac OS files (.DS_Store)
-- Python cache files
-- Node modules
-- IDE files (.vscode, .idea)
-- Credentials and secrets
-- Build artifacts
-- Temporary files
-
-### 📚 Key Features of New Documentation
-
-#### Getting Started Guide
-- Installation instructions for MySQL, Python, Java, Node.js, MongoDB, Neo4j
-- Troubleshooting section with common issues and solutions
-- Quick start guides for different skill levels (Beginner, Intermediate, Advanced)
-- Testing instructions to verify setup
-
-#### Course Syllabus
-- Complete 16-week curriculum
-- 5 modules covering all topics
-- Weekly schedule with topics, labs, and assignments
-- Grading policy and assessment criteria
-- Project ideas and deliverables
-- Course policies and expectations
-
-#### SQL Cheat Sheet
-- Comprehensive reference organized by topic
-- Database operations (CREATE, DROP, USE)
-- Table operations (CREATE, ALTER, DROP)
-- Data manipulation (INSERT, UPDATE, DELETE)
-- Querying (SELECT, WHERE, JOIN, etc.)
-- Aggregate functions and GROUP BY
-- Subqueries and CTEs
-- Window functions
-- Transactions and indexes
-- Views, stored procedures, and triggers
-- Performance tips and best practices
-
-#### Lab Index
-- Detailed descriptions of all 21 labs
-- Learning objectives for each lab
-- Prerequisites clearly stated
-- Duration estimates
-- Difficulty levels (🟢 Beginner, 🟡 Intermediate, 🟠 Advanced, 🔴 Expert)
-- Multiple learning paths for different goals
-- Search by topic feature
-
-#### Contributing Guide
-- How to report bugs
-- How to suggest enhancements
-- Code style guidelines for SQL, Python, and Java
-- Commit message conventions
-- Pull request process
-- Recognition system
-
-#### Practice Exercises
-- Additional exercises beyond the labs
-- Organized by topic (Basic SQL, Joins, Aggregates, etc.)
-- Challenge problems for advanced learners
-- Difficulty ratings
-- Links to external practice platforms
-
-#### FAQ
-- Answers to 40+ common questions
-- Organized by category (General, Getting Started, Technical Issues, etc.)
-- Troubleshooting tips
-- Links to relevant documentation
-
-#### Project Roadmap
-- Vision for the project
-- Current status
-- Short-term goals (3 months)
-- Medium-term goals (3-6 months)
-- Long-term goals (6-12 months)
-- Future considerations (1-2 years)
-- Success metrics
-- How to contribute to roadmap
-
-### 🔄 Migration from Old to New Structure
-
-The s26 branch maintains backward compatibility while adding new organization:
-
-| Old Location | New Location | Status |
-|--------------|--------------|--------|
-| `/html_labs/*.html` | `/labs/html_labs/*.html` | Copied (originals preserved) |
-| `/inclass/*.ipynb` | `/labs/notebooks/*.ipynb` | Copied (originals preserved) |
-| `/code/*` | `/labs/code/*` | Copied (originals preserved) |
-| Root level docs | `/docs/` | New organization |
-
-**Note**: Original files are preserved for backward compatibility. Links in README updated to new locations.
-
-### 🎯 Benefits of S26 Changes
-
-#### For Students
-- ✅ Clear getting started instructions
-- ✅ Comprehensive learning paths
-- ✅ Quick reference materials
-- ✅ Troubleshooting help
-- ✅ FAQ for common questions
-- ✅ Additional practice exercises
-
-#### For Instructors
-- ✅ Complete 16-week curriculum
-- ✅ Weekly schedule ready to use
-- ✅ Assessment guidelines
-- ✅ Project ideas
-- ✅ Grading policies
-- ✅ Structured content
-
-#### For Contributors
-- ✅ Clear contributing guidelines
-- ✅ Code style standards
-- ✅ Pull request process
-- ✅ Recognition system
-- ✅ Roadmap for future work
-
-#### For the Project
-- ✅ Professional appearance
-- ✅ Better discoverability
-- ✅ Easier maintenance
-- ✅ Scalable structure
-- ✅ Community-ready
-- ✅ Version tracking
-
-### 📈 Metrics
-
-**Documentation Growth:**
-- Files added: 10 major documents + reorganization
-- Total new content: ~93,500 characters
-- Documentation coverage: Increased from ~20% to ~95%
-
-**Organization Improvements:**
-- New directories: 4 (docs/, labs/, exercises/, solutions/)
-- Reorganized files: 50+ HTML labs, notebooks, and code examples
-- Updated references: All links in README
-
-**User Experience:**
-- Navigation improved: Quick links, cross-references
-- Accessibility: Multiple entry points (by skill level, topic, etc.)
-- Support: Troubleshooting, FAQ, contributing guides
-
-### 🚀 What This Means
-
-The s26 branch transforms DBMS-SQL-Labs from a **collection of labs** into a **complete educational platform** with:
-
-1. **Professional Documentation** - Industry-standard docs that rival commercial courses
-2. **Better Organization** - Clear structure makes content easy to find
-3. **Learning Support** - Multiple resources help students at every level
-4. **Community Ready** - Clear guidelines encourage contributions
-5. **Instructor Friendly** - Complete curriculum ready to use in classes
-6. **Future Proof** - Scalable structure supports future growth
-
-### 📋 Checklist of Changes
-
-- [x] Create comprehensive Getting Started guide
-- [x] Create 16-week course syllabus
-- [x] Create SQL cheat sheet reference
-- [x] Create contributing guidelines
-- [x] Create complete lab index
-- [x] Add practice exercises
-- [x] Create project roadmap
-- [x] Create changelog
-- [x] Create contributors file
-- [x] Create FAQ
-- [x] Reorganize directory structure
-- [x] Update main README
-- [x] Improve .gitignore
-- [x] Add cross-references throughout
-- [x] Create learning paths
-
-### 🎓 How to Use S26 Branch
-
-#### For New Users
-1. Start with [Getting Started Guide](docs/GETTING_STARTED.md)
-2. Review [Lab Index](LAB_INDEX.md) to understand what's available
-3. Follow the beginner learning path
-4. Reference [SQL Cheat Sheet](docs/SQL_CHEAT_SHEET.md) as needed
-5. Check [FAQ](docs/FAQ.md) for common questions
-
-#### For Instructors
-1. Review [Course Syllabus](docs/COURSE_SYLLABUS.md)
-2. Adapt the 16-week schedule to your needs
-3. Use labs sequentially or customize
-4. Assign projects from syllabus
-5. Encourage students to contribute
-
-#### For Contributors
-1. Read [Contributing Guide](docs/CONTRIBUTING.md)
-2. Check [Roadmap](docs/ROADMAP.md) for planned work
-3. Pick an area to contribute
-4. Submit pull request
-5. Get recognized in [Contributors](CONTRIBUTORS.md)
-
-### 🔮 What's Next?
-
-See the [Roadmap](docs/ROADMAP.md) for future plans:
-- Convert HTML labs to Markdown
-- Add video tutorials
-- Create interactive SQL playground
-- Implement auto-grading
-- Multi-language support
-- Certification program
-
-### 📞 Questions?
-
-- See [FAQ](docs/FAQ.md)
-- Check [Contributing Guide](docs/CONTRIBUTING.md)
-- Open an issue on GitHub
-- Review other documentation in `/docs`
-
----
-
-## Conclusion
-
-The **s26 branch** represents a complete transformation of DBMS-SQL-Labs into a professional, comprehensive, and well-documented educational resource. With nearly 100,000 characters of new documentation, reorganized structure, and enhanced user experience, this update positions the project for significant growth and impact in the database education community.
-
-**Version**: 2.0.0
-**Branch**: s26
-**Release Date**: February 7, 2026
-**Status**: ✅ Complete and Ready for Use
-
----
-
-*For detailed changes, see [CHANGELOG.md](CHANGELOG.md)*
-*For the main README, see [Readme.md](Readme.md)*
-*For all documentation, see [/docs](docs/)*
diff --git a/SQL_LAB_COMPARISON.md b/SQL_LAB_COMPARISON.md
deleted file mode 100644
index 7fae004..0000000
--- a/SQL_LAB_COMPARISON.md
+++ /dev/null
@@ -1,287 +0,0 @@
-# SQL Lab Comparison Guide
-
-## Overview
-
-This document compares the two SQL learning resources now available in this repository:
-
-1. **SQL Quick Start Guide** (Simplified, New Branch)
-2. **SQL Fundamentals - Complete Guide** (Comprehensive)
-
----
-
-## Quick Comparison Table
-
-| Feature | SQL Quick Start Guide | SQL Fundamentals - Complete |
-|---------|----------------------|----------------------------|
-| **File** | `SQL_Quick_Start_Guide.md` | `Lab_Reorganized_SQL_Fundamentals.md` |
-| **Branch** | `copilot/sql-quick-start` | `copilot/create-tables-and-queries` |
-| **Length** | 460 lines (~9 KB) | 1,852 lines (~49 KB) |
-| **Estimated Time** | 3-4 hours | 8-12 hours |
-| **Approach** | Fast-track, practical | In-depth, comprehensive |
-| **Examples per Topic** | 1-2 focused | 5-10 detailed |
-| **Practice Exercises** | 10 prompts | 40+ exercises |
-| **Explanations** | Concise bullets | Detailed paragraphs |
-| **Advanced Topics** | Omitted | Included |
-| **Edge Cases** | Omitted | Covered |
-| **Best For** | Quick learners, reference | Thorough study, teaching |
-
----
-
-## Detailed Comparison
-
-### 1. Structure
-
-**Quick Start:**
-- 10 main topics only
-- 1-2 subsections per topic
-- Quick reference table at end
-- Scannable format
-
-**Comprehensive:**
-- 10 main topics
-- 8-15 subsections per topic
-- Detailed explanations throughout
-- Progressive learning structure
-
-### 2. Content Philosophy
-
-**Quick Start:**
-- "Just enough to get started"
-- One clear example per concept
-- Focus on most common use cases
-- Practical over theoretical
-
-**Comprehensive:**
-- "Everything you need to know"
-- Multiple examples showing variations
-- Cover common and edge cases
-- Theory and practice balanced
-
-### 3. Example: CREATE TABLE Section
-
-**Quick Start (45 lines):**
-```
-- One table creation example
-- Basic data types only
-- One INSERT example
-- One practice prompt
-```
-
-**Comprehensive (200+ lines):**
-```
-- Multiple table examples
-- All common data types explained
-- Multiple INSERT patterns
-- Data verification
-- Additional examples
-- 2 detailed practice exercises
-```
-
-### 4. Example: JOIN Section
-
-**Quick Start:**
-- INNER JOIN focus
-- One complete example
-- Brief mention of LEFT JOIN
-- Simple practice
-
-**Comprehensive:**
-- INNER, LEFT, RIGHT JOINs
-- Multiple examples per type
-- Self-joins explained
-- CROSS JOIN covered
-- 3+ tables examples
-- 5 practice exercises
-
-### 5. Code Examples
-
-**Quick Start:**
-```sql
--- Single focused example
-SELECT * FROM products
-WHERE price < 300;
-```
-
-**Comprehensive:**
-```sql
--- Multiple variations shown
--- Example 1: Simple
-SELECT * FROM products WHERE price < 300;
-
--- Example 2: With AND
-SELECT * FROM products
-WHERE price < 300 AND category = 'Electronics';
-
--- Example 3: With OR
-SELECT * FROM products
-WHERE price < 300 OR category = 'Furniture';
-
--- Example 4: Complex
-SELECT * FROM products
-WHERE (price < 300 OR price > 1000)
-AND category IN ('Electronics', 'Furniture');
-```
-
----
-
-## When to Use Each Guide
-
-### Use SQL Quick Start Guide If:
-✅ You want to start coding SQL quickly
-✅ You learn best by doing
-✅ You need a quick reference
-✅ You're comfortable figuring things out
-✅ Time is limited (3-4 hours available)
-✅ You prefer concise explanations
-✅ You get overwhelmed by too much detail
-
-### Use SQL Fundamentals Complete If:
-✅ You want thorough understanding
-✅ You're preparing for exams
-✅ You need to teach SQL to others
-✅ You want to see all variations
-✅ Time is not a constraint (8-12 hours available)
-✅ You prefer detailed explanations
-✅ You want to understand edge cases
-
----
-
-## Learning Path Recommendations
-
-### Path 1: Quick Start First
-1. Complete SQL Quick Start Guide (3-4 hrs)
-2. Practice building your own database
-3. Return to Comprehensive guide for specific topics
-4. **Best for:** Self-motivated learners
-
-### Path 2: Comprehensive Only
-1. Work through Complete Guide sequentially (8-12 hrs)
-2. Complete all exercises
-3. Build a capstone project
-4. **Best for:** Academic learners, instructors
-
-### Path 3: Combined Approach
-1. Skim Quick Start for overview (1 hr)
-2. Use Comprehensive for deep dives (6-8 hrs)
-3. Keep Quick Start as reference
-4. **Best for:** Most learners
-
----
-
-## Content Coverage
-
-Both guides cover the same 10 topics in the same order:
-
-1. **Create Tables** ✅
-2. **Single Table Query** ✅
-3. **DISTINCT** ✅
-4. **ORDER BY** ✅
-5. **Foreign Key** ✅
-6. **Multi Table** ✅
-7. **Aggregate Functions** ✅
-8. **GROUP BY** ✅
-9. **HAVING** ✅
-10. **Set Operations** ✅
-
-The difference is in depth, not coverage.
-
----
-
-## What's Simplified in Quick Start?
-
-### Removed:
-- ❌ Advanced subsections
-- ❌ Multiple variations of same concept
-- ❌ Lengthy theoretical explanations
-- ❌ Edge case discussions
-- ❌ Performance optimization details
-- ❌ Common mistakes sections (kept tips only)
-- ❌ Historical context
-- ❌ Multiple practice exercises (kept 1 per section)
-
-### Kept:
-- ✅ Core concepts for each topic
-- ✅ Essential syntax
-- ✅ One clear example per concept
-- ✅ Practice prompts
-- ✅ Quick tips
-- ✅ Resources for further learning
-
-### Added:
-- ➕ Quick reference summary table
-- ➕ Success tips section
-- ➕ Consistent single dataset throughout
-- ➕ More white space for readability
-
----
-
-## File Locations
-
-### Quick Start Guide
-- **Markdown**: `/SQL_Quick_Start_Guide.md`
-- **HTML**: `/labs/html_labs/SQL_Quick_Start_Guide.html`
-- **Branch**: `copilot/sql-quick-start`
-
-### Comprehensive Guide
-- **Markdown**: `/Lab_Reorganized_SQL_Fundamentals.md`
-- **HTML**: `/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html`
-- **Branch**: `copilot/create-tables-and-queries`
-
----
-
-## Statistics
-
-### Quick Start Guide
-- Lines of code: 460
-- File size: ~9 KB
-- Sections: 10 main topics
-- Subsections: ~20 total
-- Code examples: ~20
-- Practice prompts: 10
-- Estimated reading: 45 minutes
-- Estimated practice: 2.5-3.5 hours
-
-### Comprehensive Guide
-- Lines of code: 1,852
-- File size: ~49 KB
-- Sections: 10 main topics
-- Subsections: 142 total
-- Code examples: 100+
-- Practice exercises: 40+
-- Estimated reading: 3-4 hours
-- Estimated practice: 5-8 hours
-
----
-
-## Feedback and Improvements
-
-Both guides are living documents. If you:
-- Find errors or typos
-- Have suggestions for improvement
-- Want additional examples
-- Need clarification on concepts
-
-Please open an issue or submit a pull request!
-
----
-
-## Conclusion
-
-**Both guides teach the same fundamental SQL concepts.**
-
-The difference is pedagogical approach:
-- Quick Start = "Show me what I need, now"
-- Comprehensive = "Teach me everything about this"
-
-Choose based on your:
-- Learning style
-- Time available
-- Goals (quick start vs deep mastery)
-- Use case (reference vs study)
-
-**Most importantly: Both will make you proficient in SQL!** 🚀
-
----
-
-**Created:** February 11, 2026
-**Purpose:** Help learners choose the right guide for their needs
diff --git a/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html b/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html
deleted file mode 100644
index b645b2d..0000000
--- a/labs/html_labs/Lab_Reorganized_SQL_Fundamentals.html
+++ /dev/null
@@ -1,235 +0,0 @@
-
-
-
-
-
- SQL Fundamentals - Reorganized Lab Guide
-
-
-
-
-
-
-
-
-
-
This comprehensive guide covers fundamental SQL concepts in a logical progression, from basic table creation to advanced set operations. Each section builds upon the previous one, providing a structured learning path for database management.
-
-
Prerequisites:
-
-
MySQL or MariaDB server installed and running
-
Basic understanding of relational database concepts
-
Access to a SQL client (command line, MySQL Workbench, etc.)
-
-
-
-
-
1. Create Tables
-
-
1.1 Introduction to Database and Table Creation
-
A database is a container that holds related tables. Before creating tables, you must first create and select a database.
-
-
1.2 Create a Database
-
-
-- Create a new database
-CREATE DATABASE sql_fundamentals;
-
--- Switch to the database
-USE sql_fundamentals;
-
-
-
-
-
Note: Database names are case-sensitive on some systems. Use lowercase for consistency.
-
-
1.3 Understanding Data Types
-
Common MySQL data types:
-
-
INT: Integer numbers
-
DECIMAL(p,s): Fixed-point numbers (e.g., DECIMAL(10,2) for prices)
-
VARCHAR(n): Variable-length strings up to n characters
This HTML page provides a preview. For the complete, detailed guide covering all 10 topics with comprehensive examples, exercises, and explanations, please view:
-
-
-
-
-
From c3f65433805224a57c5a18f9cbc28bee275ebadd Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 11 Feb 2026 05:40:37 +0000
Subject: [PATCH 08/10] Remove all non-essential files - keep only Quick Start
Guide essentials
Co-authored-by: khalefa-ow <88914125+khalefa-ow@users.noreply.github.com>
---
In-Class Exercise | 36 -
Lab_Case_Expression.md | 470 -----
_layouts/default.html | 157 --
bank.md | 97 -
bank_trigger.sql | 108 --
code/.DS_Store | Bin 6148 -> 0 bytes
code/Lab6/credentials.json | 4 -
code/Lab6/showDatabases.js | 0
code/Lab6/summarize-db.js | 0
code/Lab7/.DS_Store | Bin 6148 -> 0 bytes
code/Lab7/lab7server.js | 12 -
code/Lab7/public/buttons.js | 41 -
code/Lab7/public/index.html | 21 -
code/Lab8/.DS_Store | Bin 6148 -> 0 bytes
code/Lab8/express.js | 35 -
code/Lab8/public/click.js | 54 -
code/Lab8/public/index.html | 25 -
convert_html.py | 336 ----
data/IMDB-Movie-Data.csv | 1001 -----------
data/airtravel.csv | 14 -
data/case_expression_lab.sql | 226 ---
data/cities.csv | 130 --
data/drivers.sql | 38 -
data/drivers_sol.sql | 19 -
data/employees.csv | 51 -
data/grades.csv | 17 -
docs/CONTRIBUTING.md | 437 -----
docs/COURSE_SYLLABUS.md | 394 -----
docs/FAQ.md | 273 ---
docs/ROADMAP.md | 312 ----
exercises/PRACTICE_EXERCISES.md | 342 ----
html_labs/Foreign_Keys.html | 584 -------
html_labs/InClassExercises.html | 789 ---------
html_labs/Isolation_Levels.html | 860 ---------
html_labs/Lab10_mongoDB.html | 263 ---
html_labs/Lab11_neo4j.html | 389 ----
html_labs/Lab2.html | 1557 -----------------
html_labs/Lab3_Normal_forms.html | 926 ----------
html_labs/Lab4.html | 780 ---------
html_labs/Lab4_sql.html | 782 ---------
html_labs/Lab5_views.html | 408 -----
html_labs/Lab7_nodejs.html | 1091 ------------
html_labs/Lab9.html | 181 --
html_labs/Lab_Case_Expression.html | 655 -------
html_labs/Lab_JSON-XML.html | 237 ---
html_labs/Lab_Python.html | 267 ---
html_labs/Lecture_Example_1.html | 155 --
html_labs/Multi_Tables.html | 240 ---
html_labs/MultipleCallbackCoordination.html | 321 ----
html_labs/Old.html | 1061 -----------
html_labs/Transactions.html | 410 -----
html_labs/Triggers.html | 188 --
html_labs/lab6_cursors.html | 203 ---
html_labs/lab8_.html | 308 ----
html_labs/lab_java.html | 263 ---
html_labs/lab_java_2.html | 578 ------
html_labs/lab_java_3.html | 583 ------
images/a.txt | 1 -
images/image1.jpg | Bin 28112 -> 0 bytes
inclass/Mysql-Jupyter.ipynb | 588 -------
inclass/Rollup.ipynb | 573 ------
inclass/Triggers.ipynb | 624 -------
inclass/users.sql | 8 -
items-0.json | 1 -
labs/code/.DS_Store | Bin 6148 -> 0 bytes
labs/code/Lab6/credentials.json | 4 -
labs/code/Lab6/showDatabases.js | 0
labs/code/Lab6/summarize-db.js | 0
labs/code/Lab7/.DS_Store | Bin 6148 -> 0 bytes
labs/code/Lab7/lab7server.js | 12 -
labs/code/Lab7/public/buttons.js | 41 -
labs/code/Lab7/public/index.html | 21 -
labs/code/Lab8/.DS_Store | Bin 6148 -> 0 bytes
labs/code/Lab8/express.js | 35 -
labs/code/Lab8/public/click.js | 54 -
labs/code/Lab8/public/index.html | 25 -
labs/html_labs/Foreign_Keys.html | 602 -------
labs/html_labs/InClassExercises.html | 807 ---------
labs/html_labs/Isolation_Levels.html | 878 ----------
labs/html_labs/Lab10_mongoDB.html | 281 ---
labs/html_labs/Lab11_neo4j.html | 407 -----
labs/html_labs/Lab2.html | 124 --
labs/html_labs/Lab2_Original_Backup.html | 1557 -----------------
labs/html_labs/Lab2_Part1_Joins.html | 769 --------
labs/html_labs/Lab2_Part2_Aggregates.html | 1000 -----------
labs/html_labs/Lab2_Part3_SetOperations.html | 625 -------
labs/html_labs/Lab3_Normal_forms.html | 944 ----------
labs/html_labs/Lab4.html | 798 ---------
labs/html_labs/Lab4_sql.html | 800 ---------
labs/html_labs/Lab5_views.html | 425 -----
labs/html_labs/Lab7_nodejs.html | 1091 ------------
labs/html_labs/Lab9.html | 181 --
labs/html_labs/Lab_Case_Expression.html | 672 -------
labs/html_labs/Lab_JSON-XML.html | 255 ---
labs/html_labs/Lab_Python.html | 285 ---
labs/html_labs/Lecture_Example_1.html | 155 --
labs/html_labs/Multi_Tables.html | 258 ---
.../MultipleCallbackCoordination.html | 321 ----
labs/html_labs/Old.html | 1061 -----------
labs/html_labs/Transactions.html | 428 -----
labs/html_labs/Triggers.html | 206 ---
labs/html_labs/lab6_cursors.html | 203 ---
labs/html_labs/lab8_.html | 308 ----
labs/html_labs/lab_java.html | 263 ---
labs/html_labs/lab_java_2.html | 578 ------
labs/html_labs/lab_java_3.html | 600 -------
labs/notebooks/Mysql-Jupyter.ipynb | 588 -------
labs/notebooks/Rollup.ipynb | 573 ------
labs/notebooks/Triggers.ipynb | 624 -------
labs/notebooks/users.sql | 8 -
orm.md | 205 ---
recursive_triggers.sql | 67 -
112 files changed, 39663 deletions(-)
delete mode 100644 In-Class Exercise
delete mode 100644 Lab_Case_Expression.md
delete mode 100644 _layouts/default.html
delete mode 100644 bank.md
delete mode 100644 bank_trigger.sql
delete mode 100644 code/.DS_Store
delete mode 100644 code/Lab6/credentials.json
delete mode 100644 code/Lab6/showDatabases.js
delete mode 100644 code/Lab6/summarize-db.js
delete mode 100644 code/Lab7/.DS_Store
delete mode 100644 code/Lab7/lab7server.js
delete mode 100644 code/Lab7/public/buttons.js
delete mode 100644 code/Lab7/public/index.html
delete mode 100644 code/Lab8/.DS_Store
delete mode 100644 code/Lab8/express.js
delete mode 100644 code/Lab8/public/click.js
delete mode 100644 code/Lab8/public/index.html
delete mode 100644 convert_html.py
delete mode 100644 data/IMDB-Movie-Data.csv
delete mode 100644 data/airtravel.csv
delete mode 100644 data/case_expression_lab.sql
delete mode 100644 data/cities.csv
delete mode 100644 data/drivers.sql
delete mode 100644 data/drivers_sol.sql
delete mode 100644 data/employees.csv
delete mode 100644 data/grades.csv
delete mode 100644 docs/CONTRIBUTING.md
delete mode 100644 docs/COURSE_SYLLABUS.md
delete mode 100644 docs/FAQ.md
delete mode 100644 docs/ROADMAP.md
delete mode 100644 exercises/PRACTICE_EXERCISES.md
delete mode 100644 html_labs/Foreign_Keys.html
delete mode 100644 html_labs/InClassExercises.html
delete mode 100644 html_labs/Isolation_Levels.html
delete mode 100644 html_labs/Lab10_mongoDB.html
delete mode 100644 html_labs/Lab11_neo4j.html
delete mode 100644 html_labs/Lab2.html
delete mode 100644 html_labs/Lab3_Normal_forms.html
delete mode 100644 html_labs/Lab4.html
delete mode 100644 html_labs/Lab4_sql.html
delete mode 100644 html_labs/Lab5_views.html
delete mode 100644 html_labs/Lab7_nodejs.html
delete mode 100644 html_labs/Lab9.html
delete mode 100644 html_labs/Lab_Case_Expression.html
delete mode 100644 html_labs/Lab_JSON-XML.html
delete mode 100644 html_labs/Lab_Python.html
delete mode 100644 html_labs/Lecture_Example_1.html
delete mode 100644 html_labs/Multi_Tables.html
delete mode 100644 html_labs/MultipleCallbackCoordination.html
delete mode 100644 html_labs/Old.html
delete mode 100644 html_labs/Transactions.html
delete mode 100644 html_labs/Triggers.html
delete mode 100644 html_labs/lab6_cursors.html
delete mode 100644 html_labs/lab8_.html
delete mode 100644 html_labs/lab_java.html
delete mode 100644 html_labs/lab_java_2.html
delete mode 100644 html_labs/lab_java_3.html
delete mode 100644 images/a.txt
delete mode 100644 images/image1.jpg
delete mode 100644 inclass/Mysql-Jupyter.ipynb
delete mode 100644 inclass/Rollup.ipynb
delete mode 100644 inclass/Triggers.ipynb
delete mode 100644 inclass/users.sql
delete mode 100644 items-0.json
delete mode 100644 labs/code/.DS_Store
delete mode 100644 labs/code/Lab6/credentials.json
delete mode 100644 labs/code/Lab6/showDatabases.js
delete mode 100644 labs/code/Lab6/summarize-db.js
delete mode 100644 labs/code/Lab7/.DS_Store
delete mode 100644 labs/code/Lab7/lab7server.js
delete mode 100644 labs/code/Lab7/public/buttons.js
delete mode 100644 labs/code/Lab7/public/index.html
delete mode 100644 labs/code/Lab8/.DS_Store
delete mode 100644 labs/code/Lab8/express.js
delete mode 100644 labs/code/Lab8/public/click.js
delete mode 100644 labs/code/Lab8/public/index.html
delete mode 100644 labs/html_labs/Foreign_Keys.html
delete mode 100644 labs/html_labs/InClassExercises.html
delete mode 100644 labs/html_labs/Isolation_Levels.html
delete mode 100644 labs/html_labs/Lab10_mongoDB.html
delete mode 100644 labs/html_labs/Lab11_neo4j.html
delete mode 100644 labs/html_labs/Lab2.html
delete mode 100644 labs/html_labs/Lab2_Original_Backup.html
delete mode 100644 labs/html_labs/Lab2_Part1_Joins.html
delete mode 100644 labs/html_labs/Lab2_Part2_Aggregates.html
delete mode 100644 labs/html_labs/Lab2_Part3_SetOperations.html
delete mode 100644 labs/html_labs/Lab3_Normal_forms.html
delete mode 100644 labs/html_labs/Lab4.html
delete mode 100644 labs/html_labs/Lab4_sql.html
delete mode 100644 labs/html_labs/Lab5_views.html
delete mode 100644 labs/html_labs/Lab7_nodejs.html
delete mode 100644 labs/html_labs/Lab9.html
delete mode 100644 labs/html_labs/Lab_Case_Expression.html
delete mode 100644 labs/html_labs/Lab_JSON-XML.html
delete mode 100644 labs/html_labs/Lab_Python.html
delete mode 100644 labs/html_labs/Lecture_Example_1.html
delete mode 100644 labs/html_labs/Multi_Tables.html
delete mode 100644 labs/html_labs/MultipleCallbackCoordination.html
delete mode 100644 labs/html_labs/Old.html
delete mode 100644 labs/html_labs/Transactions.html
delete mode 100644 labs/html_labs/Triggers.html
delete mode 100644 labs/html_labs/lab6_cursors.html
delete mode 100644 labs/html_labs/lab8_.html
delete mode 100644 labs/html_labs/lab_java.html
delete mode 100644 labs/html_labs/lab_java_2.html
delete mode 100644 labs/html_labs/lab_java_3.html
delete mode 100644 labs/notebooks/Mysql-Jupyter.ipynb
delete mode 100644 labs/notebooks/Rollup.ipynb
delete mode 100644 labs/notebooks/Triggers.ipynb
delete mode 100644 labs/notebooks/users.sql
delete mode 100644 orm.md
delete mode 100644 recursive_triggers.sql
diff --git a/In-Class Exercise b/In-Class Exercise
deleted file mode 100644
index e9921db..0000000
--- a/In-Class Exercise
+++ /dev/null
@@ -1,36 +0,0 @@
-## In-Class Exercise (from UMM)
-
-Feel Free to search for the exact command format.
-
-In particular you are going to need to figure out how the `CREATE TABLE` and `INSERT` statements work. You will also need to figure out a little bit about SQL data-types. If you have any questions feel free to ask. With that in mind, here's what I
-want you to do (or have already done):
-
-1. Create your database. You will use this database for all your work.
-
-2. Create a table called `workers` with the following fields (all capital):
-
-Column Name | Description
-------------|--------------
-EMPLOYEE | The person's name
-MANAGER | The manager's name
-JOB | A job title
-SALARY | a yearly salary
-YEARS_WORKED| The number of years worked
-
-You get to pick the data-types for the fields
-
-1. Enter data that satisfies ALL of the following restrictions into your table:
- * Roberts, Ruskin, and Raphael are all ticket agents.
- * Rayburn is a baggage handler.
- * Rice is a flight mechanic.
- * Price manages all ticket agents.
- * Powell manages Rayburn.
- * Porter manages Rice, Price, Powell and himself.
- * Powell is head of ground crews and Porter is chief of operations.
- * Every employee receives a 10% raise for each complete year worked.
- * Roberts, Ruskin, Raphael, and Rayburn all started at $12,000. Roberts just started work, Ruskin
-and Raphael have worked for a year and a half, and Rayburn has worked for 2 years.
- * Rice started at $18,000 and now makes $21,780.
- * Price and Powell started at $16,000 and have both been working for three years.
- * Porter started at $20,000 and has been around two years longer than anyone else.
-
diff --git a/Lab_Case_Expression.md b/Lab_Case_Expression.md
deleted file mode 100644
index 9255018..0000000
--- a/Lab_Case_Expression.md
+++ /dev/null
@@ -1,470 +0,0 @@
-# Lab: SQL CASE Expressions
-
-## 🎯 Learning Objectives
-
-By the end of this lab, you will be able to:
-- Understand and use SQL CASE expressions effectively
-- Compare CASE expressions with alternative query approaches
-- Apply CASE expressions in SELECT, WHERE, and HAVING clauses
-- Use CASE with aggregate functions for conditional counting
-- Understand when CASE expressions improve query readability and performance
-
-## 📋 Prerequisites
-
-- Understanding of basic SQL SELECT statements
-- Knowledge of aggregate functions (COUNT, SUM, AVG)
-- Familiarity with GROUP BY and HAVING clauses
-- Basic understanding of subqueries and CTEs (Common Table Expressions)
-
-## 📚 Introduction
-
-The **CASE expression** is one of SQL's most powerful and versatile tools. It allows you to implement conditional logic directly within your SQL queries, making your code more readable and often more efficient.
-
-### CASE Expression Syntax
-
-```sql
--- Simple CASE (comparing against a single column)
-CASE column_name
- WHEN value1 THEN result1
- WHEN value2 THEN result2
- ELSE default_result
-END
-
--- Searched CASE (more flexible with conditions)
-CASE
- WHEN condition1 THEN result1
- WHEN condition2 THEN result2
- ELSE default_result
-END
-```
-
-### Common Use Cases
-
-1. **Conditional Aggregation**: Count or sum only rows meeting specific criteria
-2. **Data Transformation**: Convert values or categorize data
-3. **Complex Filtering**: Implement sophisticated WHERE/HAVING conditions
-4. **Pivot Operations**: Transform rows into columns
-
-## 🚀 Getting Started
-
-### Step 1: Create the Database and Sample Data
-
-We'll work with an `app_events` table that tracks user interactions in a mobile application. This realistic scenario demonstrates how CASE expressions can analyze user behavior patterns.
-
-```sql
--- Create database
-DROP DATABASE IF EXISTS case_lab;
-CREATE DATABASE case_lab;
-USE case_lab;
-
--- Create app_events table
-CREATE TABLE app_events (
- event_id INT AUTO_INCREMENT PRIMARY KEY,
- session_id INT NOT NULL,
- user_id INT NOT NULL,
- event_type VARCHAR(20) NOT NULL,
- event_timestamp TIMESTAMP NOT NULL,
- INDEX idx_session (session_id),
- INDEX idx_user (user_id),
- INDEX idx_type (event_type)
-);
-
--- Insert sample data with various event types
-INSERT INTO app_events (session_id, user_id, event_type, event_timestamp) VALUES
--- Session 1: Active session with lots of scrolling, few clicks, no purchase
-(1, 101, 'scroll', '2024-01-15 10:00:00'),
-(1, 101, 'scroll', '2024-01-15 10:05:00'),
-(1, 101, 'scroll', '2024-01-15 10:10:00'),
-(1, 101, 'scroll', '2024-01-15 10:15:00'),
-(1, 101, 'scroll', '2024-01-15 10:20:00'),
-(1, 101, 'scroll', '2024-01-15 10:25:00'),
-(1, 101, 'scroll', '2024-01-15 10:30:00'),
-(1, 101, 'click', '2024-01-15 10:35:00'),
-(1, 101, 'scroll', '2024-01-15 10:40:00'),
-
--- Session 2: Short session, doesn't meet criteria
-(2, 102, 'scroll', '2024-01-15 11:00:00'),
-(2, 102, 'scroll', '2024-01-15 11:05:00'),
-(2, 102, 'click', '2024-01-15 11:08:00'),
-
--- Session 3: Session with purchase (should be excluded)
-(3, 103, 'scroll', '2024-01-15 12:00:00'),
-(3, 103, 'scroll', '2024-01-15 12:10:00'),
-(3, 103, 'scroll', '2024-01-15 12:20:00'),
-(3, 103, 'scroll', '2024-01-15 12:30:00'),
-(3, 103, 'scroll', '2024-01-15 12:40:00'),
-(3, 103, 'scroll', '2024-01-15 12:50:00'),
-(3, 103, 'click', '2024-01-15 12:55:00'),
-(3, 103, 'purchase', '2024-01-15 13:00:00'),
-
--- Session 4: Long session with many scrolls, few clicks, no purchase
-(4, 104, 'scroll', '2024-01-15 14:00:00'),
-(4, 104, 'scroll', '2024-01-15 14:08:00'),
-(4, 104, 'scroll', '2024-01-15 14:16:00'),
-(4, 104, 'scroll', '2024-01-15 14:24:00'),
-(4, 104, 'scroll', '2024-01-15 14:32:00'),
-(4, 104, 'scroll', '2024-01-15 14:40:00'),
-(4, 104, 'scroll', '2024-01-15 14:48:00'),
-(4, 104, 'scroll', '2024-01-15 14:56:00'),
-(4, 104, 'scroll', '2024-01-15 15:04:00'),
-(4, 104, 'click', '2024-01-15 15:12:00'),
-
--- Session 5: High scroll-to-click ratio session
-(5, 105, 'scroll', '2024-01-15 16:00:00'),
-(5, 105, 'scroll', '2024-01-15 16:07:00'),
-(5, 105, 'scroll', '2024-01-15 16:14:00'),
-(5, 105, 'scroll', '2024-01-15 16:21:00'),
-(5, 105, 'scroll', '2024-01-15 16:28:00'),
-(5, 105, 'scroll', '2024-01-15 16:35:00'),
-(5, 105, 'scroll', '2024-01-15 16:42:00'),
-(5, 105, 'scroll', '2024-01-15 16:49:00'),
-(5, 105, 'scroll', '2024-01-15 16:56:00'),
-(5, 105, 'scroll', '2024-01-15 17:03:00'),
-(5, 105, 'click', '2024-01-15 17:10:00');
-```
-
-## 🎓 Problem: Finding Browse-Heavy Sessions
-
-**Business Goal**: Identify user sessions that indicate a poor user experience - users who scroll a lot but don't click much and don't make purchases. These sessions may indicate:
-- Confusing UI/UX
-- Irrelevant content
-- Poor product recommendations
-- Potential bugs or performance issues
-
-### Criteria for Browse-Heavy Sessions:
-1. Session duration > 30 minutes
-2. At least 5 scroll events
-3. Click-to-scroll ratio < 0.2 (less than 20% clicks relative to scrolls)
-4. No purchase events
-
-## 💡 Solution 1: Using CASE Expressions (Clean & Efficient)
-
-This approach uses CASE expressions to conditionally count events directly within the query:
-
-```sql
--- Write your MySQL query statement below
-SELECT
- session_id,
- user_id,
- TIMESTAMPDIFF(MINUTE, MIN(event_timestamp), MAX(event_timestamp)) AS session_duration_minutes,
- COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) AS scroll_count
-FROM app_events
-GROUP BY session_id, user_id
-HAVING session_duration_minutes > 30
- AND scroll_count >= 5
- AND COUNT(CASE WHEN event_type = 'click' THEN 1 END) / scroll_count < 0.2
- AND COUNT(CASE WHEN event_type = 'purchase' THEN 1 END) = 0
-ORDER BY scroll_count DESC, session_id;
-```
-
-### How This Query Works:
-
-1. **Conditional Counting with CASE**:
- ```sql
- COUNT(CASE WHEN event_type = 'scroll' THEN 1 END)
- ```
- - The CASE expression returns 1 only when event_type is 'scroll'
- - COUNT ignores NULL values, so only scroll events are counted
- - This is more readable than filtering with WHERE
-
-2. **Session Duration Calculation**:
- ```sql
- TIMESTAMPDIFF(MINUTE, MIN(event_timestamp), MAX(event_timestamp))
- ```
- - Calculates the difference between first and last event in minutes
-
-3. **Click-to-Scroll Ratio**:
- ```sql
- COUNT(CASE WHEN event_type = 'click' THEN 1 END) / scroll_count < 0.2
- ```
- - Divides click count by scroll count to get the ratio
-
-4. **No Purchase Condition**:
- ```sql
- COUNT(CASE WHEN event_type = 'purchase' THEN 1 END) = 0
- ```
- - Ensures no purchase events exist in the session
-
-### Advantages of CASE Expression Approach:
-- ✅ **Concise**: Single query, easy to read
-- ✅ **Performant**: Single pass through the data
-- ✅ **Maintainable**: Logic is clear and straightforward
-- ✅ **Flexible**: Easy to add more conditions
-
-## 🔄 Solution 2: Using CTEs (Complex but Educational)
-
-This alternative approach uses Common Table Expressions to achieve the same result. While more verbose, it demonstrates how queries can be decomposed into logical steps:
-
-```sql
-WITH A AS (
- -- Count events by type for each session
- SELECT session_id, user_id, event_type, COUNT(*) AS c
- FROM app_events
- GROUP BY session_id, user_id, event_type
-),
-E AS (
- -- Ensure all sessions have a 'click' row (even if count is 0)
- SELECT * FROM A
- UNION
- SELECT session_id, user_id, 'click', 0
- FROM A
- WHERE session_id NOT IN (
- SELECT session_id FROM A WHERE event_type = 'click'
- )
-),
-T AS (
- -- Calculate session duration in seconds
- SELECT
- session_id,
- UNIX_TIMESTAMP(MAX(event_timestamp)) - UNIX_TIMESTAMP(MIN(event_timestamp)) AS d
- FROM app_events
- GROUP BY session_id
-),
-TT AS (
- -- Join everything together
- SELECT
- T.session_id,
- E_c.user_id,
- E_s.c AS scroll_count,
- E_c.c AS clicks,
- T.d AS duration
- FROM E E_c
- JOIN E E_s ON E_c.session_id = E_s.session_id
- JOIN T ON E_c.session_id = T.session_id
- WHERE E_s.event_type = 'scroll'
- AND E_c.event_type = 'click'
-)
-
--- Final selection with filters
-SELECT
- session_id,
- user_id,
- duration/60 AS session_duration_minutes,
- scroll_count
-FROM TT
-WHERE session_id NOT IN (
- SELECT session_id FROM E WHERE event_type = 'purchase'
-)
- AND duration > 30*60
- AND scroll_count >= 5
- AND clicks/scroll_count < 0.2
-ORDER BY scroll_count DESC, session_id;
-```
-
-### How This CTE Approach Works:
-
-1. **CTE A**: Groups events by type and counts them
-2. **CTE E**: Handles sessions with no clicks by adding a zero-count row
-3. **CTE T**: Calculates session duration in seconds
-4. **CTE TT**: Joins all CTEs together to create a comprehensive view
-5. **Final SELECT**: Applies filters and formats output
-
-### Comparison: CASE vs CTE Approach
-
-| Aspect | CASE Expression | CTE Approach |
-|--------|----------------|--------------|
-| **Lines of Code** | 10 lines | 40+ lines |
-| **Readability** | High - logic is clear | Medium - requires understanding multiple CTEs |
-| **Performance** | Better - single scan | Potentially slower - multiple scans/joins |
-| **Debugging** | Harder to debug intermediate steps | Easier - can query each CTE separately |
-| **Maintainability** | Better - less code | More complex - multiple dependencies |
-| **Use Case** | Production queries | Learning/debugging complex logic |
-
-## 🧪 Practice Exercises
-
-### Exercise 1: Basic CASE Usage
-Write a query to categorize sessions as 'short' (< 15 min), 'medium' (15-45 min), or 'long' (> 45 min):
-
-```sql
--- Your solution here
-```
-
-
-Solution
-
-```sql
-SELECT
- session_id,
- user_id,
- TIMESTAMPDIFF(MINUTE, MIN(event_timestamp), MAX(event_timestamp)) AS duration,
- CASE
- WHEN TIMESTAMPDIFF(MINUTE, MIN(event_timestamp), MAX(event_timestamp)) < 15 THEN 'short'
- WHEN TIMESTAMPDIFF(MINUTE, MIN(event_timestamp), MAX(event_timestamp)) <= 45 THEN 'medium'
- ELSE 'long'
- END AS session_category
-FROM app_events
-GROUP BY session_id, user_id;
-```
-
-
-### Exercise 2: Multiple Conditional Counts
-Write a query that shows for each session:
-- Total events
-- Number of scrolls
-- Number of clicks
-- Number of purchases
-- An engagement score (scrolls * 1 + clicks * 3 + purchases * 10)
-
-```sql
--- Your solution here
-```
-
-
-Solution
-
-```sql
-SELECT
- session_id,
- user_id,
- COUNT(*) AS total_events,
- COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) AS scroll_count,
- COUNT(CASE WHEN event_type = 'click' THEN 1 END) AS click_count,
- COUNT(CASE WHEN event_type = 'purchase' THEN 1 END) AS purchase_count,
- (COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) * 1 +
- COUNT(CASE WHEN event_type = 'click' THEN 1 END) * 3 +
- COUNT(CASE WHEN event_type = 'purchase' THEN 1 END) * 10) AS engagement_score
-FROM app_events
-GROUP BY session_id, user_id
-ORDER BY engagement_score DESC;
-```
-
-
-### Exercise 3: CASE in WHERE Clause
-Write a query to find sessions where:
-- If the session has any purchase, include it regardless of other criteria
-- If no purchase, only include if scroll_count >= 5 and duration > 20 minutes
-
-```sql
--- Your solution here
-```
-
-
-Solution
-
-```sql
-SELECT
- session_id,
- user_id,
- TIMESTAMPDIFF(MINUTE, MIN(event_timestamp), MAX(event_timestamp)) AS duration,
- COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) AS scroll_count,
- COUNT(CASE WHEN event_type = 'purchase' THEN 1 END) AS purchase_count
-FROM app_events
-GROUP BY session_id, user_id
-HAVING
- CASE
- WHEN COUNT(CASE WHEN event_type = 'purchase' THEN 1 END) > 0 THEN 1
- WHEN COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) >= 5
- AND TIMESTAMPDIFF(MINUTE, MIN(event_timestamp), MAX(event_timestamp)) > 20 THEN 1
- ELSE 0
- END = 1;
-```
-
-
-### Exercise 4: Convert CTE to CASE
-Try rewriting the following CTE query using CASE expressions:
-
-```sql
-WITH event_counts AS (
- SELECT
- session_id,
- user_id,
- SUM(CASE WHEN event_type = 'scroll' THEN 1 ELSE 0 END) AS scrolls,
- SUM(CASE WHEN event_type = 'click' THEN 1 ELSE 0 END) AS clicks
- FROM app_events
- GROUP BY session_id, user_id
-)
-SELECT * FROM event_counts WHERE scrolls > clicks * 2;
-```
-
-Can this be written more efficiently without the CTE?
-
-
-Solution
-
-```sql
-SELECT
- session_id,
- user_id,
- COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) AS scrolls,
- COUNT(CASE WHEN event_type = 'click' THEN 1 END) AS clicks
-FROM app_events
-GROUP BY session_id, user_id
-HAVING COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) >
- COUNT(CASE WHEN event_type = 'click' THEN 1 END) * 2;
-```
-
-
-## 🎓 Advanced Topics
-
-### Using CASE with SUM for Weighted Counts
-
-```sql
--- Calculate engagement score with different weights
-SELECT
- session_id,
- user_id,
- SUM(CASE
- WHEN event_type = 'scroll' THEN 1
- WHEN event_type = 'click' THEN 3
- WHEN event_type = 'purchase' THEN 10
- ELSE 0
- END) AS weighted_engagement
-FROM app_events
-GROUP BY session_id, user_id;
-```
-
-### CASE in ORDER BY for Custom Sorting
-
-```sql
--- Order by purchase first, then by scroll count
-SELECT
- session_id,
- user_id,
- COUNT(CASE WHEN event_type = 'purchase' THEN 1 END) AS purchases,
- COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) AS scrolls
-FROM app_events
-GROUP BY session_id, user_id
-ORDER BY
- CASE WHEN COUNT(CASE WHEN event_type = 'purchase' THEN 1 END) > 0 THEN 0 ELSE 1 END,
- COUNT(CASE WHEN event_type = 'scroll' THEN 1 END) DESC;
-```
-
-## 📊 Performance Considerations
-
-### When to Use CASE:
-- ✅ When you need conditional aggregation
-- ✅ When transforming data in the same query
-- ✅ When the logic is straightforward
-- ✅ When performance is critical (single pass through data)
-
-### When CTEs Might Be Better:
-- ✅ When debugging complex logic step by step
-- ✅ When the same subquery is needed multiple times
-- ✅ When logic needs to be clearly separated for readability
-- ✅ For teaching/learning purposes
-
-## 🔑 Key Takeaways
-
-1. **CASE expressions** are powerful tools for conditional logic in SQL
-2. They can be used in SELECT, WHERE, HAVING, and ORDER BY clauses
-3. CASE with aggregate functions enables conditional counting/summing
-4. The CASE approach is often **more concise and performant** than alternatives
-5. CTEs can make complex queries more **readable for debugging**
-6. Choose the approach that best balances **performance and maintainability**
-
-## 📚 Additional Resources
-
-- [MySQL CASE Documentation](https://dev.mysql.com/doc/refman/8.0/en/flow-control-functions.html#operator_case)
-- [SQL CASE Expression Best Practices](https://mode.com/sql-tutorial/sql-case/)
-- [Aggregate Functions with CASE](https://learnsql.com/blog/case-when-with-aggregate-functions/)
-
-## 🎯 Summary
-
-In this lab, you learned:
-- How to use CASE expressions for conditional logic
-- The difference between simple and searched CASE
-- How CASE expressions work with aggregate functions
-- When to use CASE vs alternative approaches like CTEs
-- Real-world applications of CASE expressions in data analysis
-
-Practice these concepts with your own datasets to master conditional logic in SQL!
diff --git a/_layouts/default.html b/_layouts/default.html
deleted file mode 100644
index 274ef82..0000000
--- a/_layouts/default.html
+++ /dev/null
@@ -1,157 +0,0 @@
-
-
-
-
-
- {{ page.title | default: "My GitHub Pages" }}
-
-
-
-
-
-
-
-
-
-
-
- {{ content }}
-
-
-
-
-
-
diff --git a/bank.md b/bank.md
deleted file mode 100644
index 37c9103..0000000
--- a/bank.md
+++ /dev/null
@@ -1,97 +0,0 @@
-
-### Assignment: Implement Overdraft Fees in a Bank Account System
-
-#### Background:
-
-You are tasked with simulating the transactions of a bank account. You have been given a starting schema that keeps track of user transactions, including deposits and withdrawals, and automatically calculates the running balance for each user.
-
-#### Task:
-
-Currently, when a user withdraws money from their account, the balance is updated accordingly. However, if a withdrawal causes the balance to go below zero, an **overdraft fee** should be applied. The overdraft fee should be added to the transaction table as a separate line item.
-
-You are required to implement the following:
-
-1. **Overdraft Fee Logic**: If a user’s account balance goes below zero after a withdrawal, an overdraft fee of $25.00 should be charged.
-2. **Separate Overdraft Transaction**: The overdraft fee should appear as a separate transaction with a type of `'overdraft_fee'` and a negative amount in the transaction table.
-
-#### Given Schema:
-
-You are provided with the following code to get started. This code creates the necessary table (`TR`) to store transactions and a trigger that calculates the running balance after each transaction.
-
-```sql
-CREATE TABLE TR (
- tid INT AUTO_INCREMENT PRIMARY KEY,
- userid INT,
- amount DECIMAL(10,2),
- type CHAR(10)
-);
-
-ALTER TABLE TR ADD COLUMN balance DECIMAL(10,2);
-
-DELIMITER //
-CREATE TRIGGER running_balance
-BEFORE INSERT ON TR
-FOR EACH ROW
-BEGIN
-DECLARE user_balance DECIMAL(10,2);
-
-SELECT balance INTO user_balance FROM TR WHERE userid=NEW.userid ORDER BY tid DESC LIMIT 1;
-IF user_balance IS NULL THEN
-SET user_balance=0;
-END IF;
-IF NEW.type='withdraw' THEN
-SET user_balance=user_balance -NEW.amount;
-END IF;
-
-IF NEW.type='deposit' THEN
- SET user_balance=user_balance + NEW.amount;
-END IF;
-
-SET NEW.balance=user_balance;
-
-END //
-DELIMITER ;
-
-INSERT INTO TR (userid, amount, type) VALUES (1,20,'deposit');
-INSERT INTO TR (userid, amount, type) VALUES (2,30,'deposit');
-INSERT INTO TR (userid, amount, type) VALUES (2,10,'withdraw');
-INSERT INTO TR (userid, amount, type) VALUES (2,30,'withdraw');
-
-SELECT * FROM TR;
-```
-
-#### Instructions:
-
-1. **Modify the Trigger**: Update the `running_balance` trigger to check if the account balance goes below zero after a withdrawal. If it does, add an overdraft fee transaction.
-
-2. **Overdraft Fee Transaction**: Add a new transaction with:
-
- * A type of `'overdraft_fee'`
- * A negative amount of `-25.00` (this represents the fee charged for overdrafting).
-
-3. **Test Your Implementation**: Insert several transactions, including withdrawals that will cause the balance to go negative, and verify that the overdraft fee is correctly applied as a separate transaction.
-
-#### Example:
-
-After running the following series of transactions:
-
-```sql
-INSERT INTO TR (userid, amount, type) VALUES (1, 50, 'deposit'); -- User 1 deposits $50
-INSERT INTO TR (userid, amount, type) VALUES (1, 70, 'withdraw'); -- User 1 withdraws $70
-INSERT INTO TR (userid, amount, type) VALUES (1, 10, 'withdraw'); -- User 1 withdraws another $10 (total balance -30)
-```
-
-The expected output in the `TR` table should look like:
-
-| tid | userid | amount | type | balance |
-| --- | ------ | ------ | ------------- | ------- |
-| 1 | 1 | 50.00 | deposit | 50.00 |
-| 2 | 1 | 70.00 | withdraw | -20.00 |
-| 3 | 1 | 10.00 | withdraw | -30.00 |
-| 4 | 1 | 25.00 | overdraft_fee | -55.00 |
-
-#### Submission:
-
-Submit the SQL code for the trigger and any necessary modifications to the schema. Be sure to include sample test cases that demonstrate how your solution works.
-
----
diff --git a/bank_trigger.sql b/bank_trigger.sql
deleted file mode 100644
index 19986af..0000000
--- a/bank_trigger.sql
+++ /dev/null
@@ -1,108 +0,0 @@
--- CREATE the user TABLE
-DROP TABLE IF EXISTS user;
-DROP TABLE IF EXISTS transactions;
-DROP TABLE IF EXISTS overdraft_fees;
-
-DROP TRIGGER IF EXISTS check_transaction_trigger;
-DROP EVENT IF EXISTS process_overdraft_fees;
-
-
-CREATE TABLE user (
- id INT AUTO_INCREMENT PRIMARY KEY,
- name VARCHAR(50) NOT NULL,
- balance DECIMAL(10, 2) DEFAULT 0.00 -- Balance WITH two DECIMAL places
-);
-
--- CREATE the transactions TABLE
-CREATE TABLE transactions (
- id INT AUTO_INCREMENT PRIMARY KEY,
- userid INT NOT NULL,
- amount DECIMAL(10, 2) NOT NULL, -- Positive FOR deposits, negative FOR withdrawals
- type INT DEFAULT 0, -- 0 FOR non-automatic, 1 FOR automatic
- FOREIGN KEY (userid) REFERENCES user(id) ON DELETE CASCADE
-);
-
--- TABLE FOR tracking overdraft fees to be processed
-CREATE TABLE overdraft_fees (
- userid INT NOT NULL,
- fee_amount DECIMAL(10, 2) DEFAULT -30.00,
- processed BOOLEAN DEFAULT FALSE
-);
-
-DELIMITER $$
-
-CREATE TRIGGER check_transaction_trigger
-AFTER INSERT ON transactions
-FOR EACH ROW
-BEGIN
- DECLARE balance_after_transaction DECIMAL(10, 2);
-
- -- Step 1: UPDATE the user's balance based ON TRANSACTION amount
- UPDATE user
- SET balance = balance + NEW.amount
- WHERE id = NEW.userid;
-
- -- Step 2: CHECK the balance AFTER the TRANSACTION
- SELECT balance INTO balance_after_transaction FROM user WHERE id = NEW.userid;
-
- -- Step 3: INSERT INTO overdraft_fees IF balance IS below zero AFTER a non-automatic withdrawal
- IF balance_after_transaction < 0 AND NEW.amount < 0 AND NEW.type = 0 THEN
- INSERT INTO overdraft_fees (userid) VALUES (NEW.userid);
-
- -- Deduct the $30 fee FROM the user's balance
- UPDATE user
- SET balance = balance - 30
- WHERE id = NEW.userid;
- END IF;
-
-END$$
-
-DELIMITER ;
-
-
-DELIMITER $$
-
-CREATE EVENT process_overdraft_fees
-ON SCHEDULE EVERY 1 MINUTE
-DO
-BEGIN
- DECLARE done INT DEFAULT FALSE;
- DECLARE overdraft_userid INT;
-
- -- CURSOR to iterate through unprocessed overdraft fees
- DECLARE fee_cursor CURSOR FOR
- SELECT userid FROM overdraft_fees WHERE processed = FALSE;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-
- OPEN fee_cursor;
-
- read_loop: LOOP
- FETCH fee_cursor INTO overdraft_userid;
- IF done THEN
- LEAVE read_loop;
- END IF;
-
- -- INSERT the fee TRANSACTION INTO the transactions TABLE
- INSERT INTO transactions (userid, amount, type)
- VALUES (overdraft_userid, -30.00, 1);
-
- -- Mark the fee AS processed
- UPDATE overdraft_fees
- SET processed = TRUE
- WHERE userid = overdraft_userid;
- END LOOP;
-
- CLOSE fee_cursor;
-END$$
-
-DELIMITER ;
-
-
--- INSERT sample users INTO the user TABLE
-INSERT INTO user (name, balance) VALUES ('Alice', 500.00);
-INSERT INTO user (name, balance) VALUES ('Bob', 1000.00);
-INSERT INTO user (name, balance) VALUES ('Charlie', 50.00);
-INSERT INTO user (name, balance) VALUES ('Diana', 0.00);
-INSERT INTO user (name, balance) VALUES ('Eve', 250.00);
-
-INSERT INTO transactions(userid, amount) VALUES (1,-300);
diff --git a/code/.DS_Store b/code/.DS_Store
deleted file mode 100644
index 0ee8899a2a43bc72b04e5145a63233dfdeb6984a..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 6148
zcmeHKL2uJA6t=ejDF{&sr0tl?Bm_M)FqTSy6uNSl#9>kpAOYHvrCKAUan+_&tSicC
zzkmz;1O5jWBqX?T=gO4}CwTAK?UFXI8$!cxvOmYqezw1_wr9o|Zw^D7u_|NCgoJ3E
zhpfcVk7>b{RLx~Tjxn}ku@}T5fNu<_O*5bw__rCry=$-s%x3}HnA^X%!FTm187*Sg
zF5b7jJ<;u{rCra*=!#ZLodM>zYoG4?`1t-_(I5WN-|OUK(=jp~*O{B&JBV90KPMOs
zdTI_If?gaA(t7<1Us^WKoIPh&;P0aO-0O&um-^{&(DeIH@oU>pJAo=c6e6CL{oqm5
z9_>`GY>FiHqom!Z&QaKgCeI#6Nhn55F-*b%#qp#A$Eoa8SI6U<>+3bkwr@;o*4T0C
zHERRPlZv^rX5Zb~?Y=x1A5LDqkz{f>NXafKoWffu%!nuoaO-v6mlxp4*98Hbt~eH;
z%wH6MG@gz7!s{ooNcLeooaeN@Q51%+fUiuL#%UL(Q50tFd!D4cFh`xw^E;!F7pBZ#
z6lNPj9}6%i4Ejzs^;0u1oZM8m&{xb&fe6S!Px(YLibaX&QPXIszs>z^CcQ&Af
z6@ae7Od`~PaoH76cIE1c!PU!w%kJQJRr^e$?9Moi3~|)RT)j{@jSlq|HD}zFsB_JL
zW}wKxviz*#{eK_!@NeG##ZLN5GoTqbRSa;W<+YlyBz3ngEDrBl3(_tmG;Ehiq%M%D
i>zE376|X`f1D}NjKv!WV5o*BnKLSL9&NKsmm4RQ@?gjb)
diff --git a/code/Lab6/credentials.json b/code/Lab6/credentials.json
deleted file mode 100644
index 0c2b119..0000000
--- a/code/Lab6/credentials.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-"user" : "you",
-"password": "password"
-}
diff --git a/code/Lab6/showDatabases.js b/code/Lab6/showDatabases.js
deleted file mode 100644
index e69de29..0000000
diff --git a/code/Lab6/summarize-db.js b/code/Lab6/summarize-db.js
deleted file mode 100644
index e69de29..0000000
diff --git a/code/Lab7/.DS_Store b/code/Lab7/.DS_Store
deleted file mode 100644
index f8442243209fe6311fa5853eff533d550b10b373..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 6148
zcmeHK!AiqG5Z!I7rihq>V2^w8)GfvW!yNUc{fpi2QikjkCy4c;M#b#ywoe|*ZHXD_dcSq>kelx>Z3cmt!f$p>c=
zg>iHT{&~(kmXH`A28e+bU_c*z#^ws_m9|I>5CcDB0M7>jifC&r6w0Fm8vK34@fsou
z*m##f6dG-fg+dqs;VKnSrE-16;3^&bLdV$}3xz73ak(
-
-
-
- Cash Register
-
-
-
-
-
-
-
Cash Register
-
-
-
-
-
-
-
-
-
diff --git a/code/Lab8/.DS_Store b/code/Lab8/.DS_Store
deleted file mode 100644
index f8442243209fe6311fa5853eff533d550b10b373..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 6148
zcmeHK!AiqG5Z!I7rihq>V2^w8)GfvW!yNUc{fpi2QikjkCy4c;M#b#ywoe|*ZHXD_dcSq>kelx>Z3cmt!f$p>c=
zg>iHT{&~(kmXH`A28e+bU_c*z#^ws_m9|I>5CcDB0M7>jifC&r6w0Fm8vK34@fsou
z*m##f6dG-fg+dqs;VKnSrE-16;3^&bLdV$}3xz73ak("+sql+"<-");
-
- connection.query(sql,(function(res){return function(err,rows,fields){
- if(err){console.log("We have an insertion error:");
- console.log(err);}
- res.send(err); // Let the upstream guy know how it went
- }})(res));
-});
-// Your other API handlers go here!
-
-app.listen(port);
diff --git a/code/Lab8/public/click.js b/code/Lab8/public/click.js
deleted file mode 100644
index 96f0275..0000000
--- a/code/Lab8/public/click.js
+++ /dev/null
@@ -1,54 +0,0 @@
-angular.module('buttons',[])
- .controller('buttonCtrl',ButtonCtrl)
- .factory('buttonApi',buttonApi)
- .constant('apiUrl','http://localhost:1337'); // CHANGED for the lab 2017!
-
-function ButtonCtrl($scope,buttonApi){
- $scope.buttons=[]; //Initially all was still
- $scope.errorMessage='';
- $scope.isLoading=isLoading;
- $scope.refreshButtons=refreshButtons;
- $scope.buttonClick=buttonClick;
-
- var loading = false;
-
- function isLoading(){
- return loading;
- }
- function refreshButtons(){
- loading=true;
- $scope.errorMessage='';
- buttonApi.getButtons()
- .success(function(data){
- $scope.buttons=data;
- loading=false;
- })
- .error(function () {
- $scope.errorMessage="Unable to load Buttons: Database request failed";
- loading=false;
- });
- }
- function buttonClick($event){
- $scope.errorMessage='';
- buttonApi.clickButton($event.target.id)
- .success(function(){})
- .error(function(){$scope.errorMessage="Unable click";});
- }
- refreshButtons(); //make sure the buttons are loaded
-
-}
-
-function buttonApi($http,apiUrl){
- return{
- getButtons: function(){
- var url = apiUrl + '/buttons';
- return $http.get(url);
- },
- clickButton: function(id){
- var url = apiUrl+'/click?id='+id;
-// console.log("Attempting with "+url);
- return $http.get(url); // Easy enough to do this way
- }
- };
-}
-
diff --git a/code/Lab8/public/index.html b/code/Lab8/public/index.html
deleted file mode 100644
index fc118d0..0000000
--- a/code/Lab8/public/index.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
- Cash Register
-
-
-
-
-
-
-
Cash Register (with buttons)
-
-
-
-
-
-
-
{{errorMessage}}
-
-
-
-
-
-
diff --git a/convert_html.py b/convert_html.py
deleted file mode 100644
index 4cfa64a..0000000
--- a/convert_html.py
+++ /dev/null
@@ -1,336 +0,0 @@
-#!/usr/bin/env python3
-"""
-Script to enhance HTML files:
-1. Fix markdown links (.md to .html)
-2. Convert markdown headings in paragraphs (### to
)
-3. Convert bold markdown (**text** to text)
-4. Convert markdown tables to HTML tables
-5. Add copy buttons to code blocks
-6. Add CSS to prevent code blocks from spanning full page width
-"""
-
-import re
-import os
-import sys
-from pathlib import Path
-
-
-def convert_markdown_table_to_html(markdown_table):
- """Convert a markdown table to HTML table format."""
- lines = [line.strip() for line in markdown_table.strip().split('\n') if line.strip()]
-
- if len(lines) < 2:
- return markdown_table # Not a valid table
-
- # Check if it's a markdown table (should have | characters)
- if not all('|' in line for line in lines):
- return markdown_table
-
- html_parts = ['
']
-
- # Process header row
- header_cells = [cell.strip() for cell in lines[0].split('|') if cell.strip()]
- if header_cells:
- html_parts.append(' ')
- html_parts.append('
')
- for cell in header_cells:
- html_parts.append(f'
{cell}
')
- html_parts.append('
')
- html_parts.append(' ')
-
- # Skip separator row (line with dashes)
- start_row = 2 if len(lines) > 1 and re.match(r'^[\s\|:\-]+$', lines[1]) else 1
-
- # Process body rows
- if start_row < len(lines):
- html_parts.append(' ')
- for line in lines[start_row:]:
- cells = [cell.strip() for cell in line.split('|') if cell.strip()]
- if cells:
- html_parts.append('
')
- return '\n'.join(html_parts)
-
-
-def add_copy_buttons_to_code_blocks(html_content):
- """Add copy buttons to code blocks in HTML content."""
-
- # Pattern to match
'
-
- html_content = re.sub(pattern, replacer, html_content)
-
- # Clean up any
tags that are now empty or just have closing tags
- html_content = re.sub(r'
\s*
', '', html_content)
-
- return html_content
-
-
-def fix_markdown_links(html_content):
- """Convert .md links to .html links in HTML files."""
- # Replace href="*.md" with href="*.html"
- # Handle both regular links and links with paths
- html_content = re.sub(r'href="([^"]*?)\.md"', r'href="\1.html"', html_content)
- return html_content
-
-
-def convert_markdown_tables_in_html(html_content):
- """Find and convert markdown tables in HTML content."""
-
- # Pattern to find markdown tables (multiple lines starting with |)
- # This pattern matches blocks of lines that start with |
- lines = html_content.split('\n')
- result_lines = []
- i = 0
-
- while i < len(lines):
- line = lines[i]
-
- # Check if this line starts a markdown table
- if line.strip().startswith('|') and '|' in line:
- # Check if the line before ends with
without closing
- if result_lines and '
' in result_lines[-1] and '
' not in result_lines[-1]:
- # Close the paragraph before the table
- result_lines[-1] = result_lines[-1] + ''
-
- # Collect all consecutive table lines
- table_lines = []
- j = i
- while j < len(lines):
- stripped = lines[j].strip()
- if stripped.startswith('|'):
- # Remove any trailing from table line
- cleaned = stripped.replace('', '').strip()
- table_lines.append(cleaned)
- j += 1
- elif stripped == '':
- # Skip standalone after table
- j += 1
- break
- else:
- break
-
- # Convert the table if we have at least 2 lines (header + separator or header + data)
- if len(table_lines) >= 2:
- markdown_table = '\n'.join(table_lines)
- html_table = convert_markdown_table_to_html(markdown_table)
- result_lines.append(html_table)
- i = j
- else:
- result_lines.append(line)
- i += 1
- else:
- result_lines.append(line)
- i += 1
-
- return '\n'.join(result_lines)
-
-
-def add_css_and_js(html_content):
- """Add CSS for copy buttons and JS for copy functionality."""
-
- # CSS for copy button and code block wrapper
- css = """
- /* Code block wrapper with copy button */
- .code-block-wrapper {
- position: relative;
- margin: 20px 0;
- max-width: 100%;
- }
-
- .code-block-wrapper pre {
- margin: 0;
- overflow-x: auto;
- max-width: 100%;
- }
-
- .copy-button {
- position: absolute;
- top: 8px;
- right: 8px;
- padding: 6px 8px;
- background-color: rgba(255, 255, 255, 0.9);
- border: 1px solid #ddd;
- border-radius: 4px;
- cursor: pointer;
- opacity: 0.7;
- transition: opacity 0.2s, background-color 0.2s;
- display: flex;
- align-items: center;
- gap: 4px;
- }
-
- .copy-button:hover {
- opacity: 1;
- background-color: #fff;
- }
-
- .copy-button:active {
- background-color: #e0e0e0;
- }
-
- .copy-button.copied {
- background-color: #4caf50;
- color: white;
- border-color: #4caf50;
- }
-
- .copy-button svg {
- display: block;
- }
- """
-
- # JavaScript for copy functionality
- js = """
- function copyCode(button) {
- const wrapper = button.closest('.code-block-wrapper');
- const codeBlock = wrapper.querySelector('code');
- const text = codeBlock.textContent;
-
- // Copy to clipboard
- navigator.clipboard.writeText(text).then(() => {
- // Show success feedback
- button.classList.add('copied');
- const originalHTML = button.innerHTML;
- button.innerHTML = '';
-
- // Reset after 2 seconds
- setTimeout(() => {
- button.classList.remove('copied');
- button.innerHTML = originalHTML;
- }, 2000);
- }).catch(err => {
- console.error('Failed to copy:', err);
- alert('Failed to copy code');
- });
- }
- """
-
- # Insert CSS before or
- if '' in html_content:
- html_content = html_content.replace('', f'{css}\n ')
- elif '' in html_content:
- html_content = html_content.replace('', f'\n')
-
- # Insert JS before