A structured collection of MySQL practice scripts and exercises developed during the SQL Primer course. This repository provides a day-by-day roadmap covering foundational DDL/DML operations to advanced relational database concepts like window functions, stored procedures, triggers, and analytical views.
This repository serves as a hands-on guide for learning SQL using MySQL Workbench. The scripts follow a progressive learning path designed to help developers and analysts build, query, and optimize relational databases through practical SQL execution.
- 📊 Structured Curriculum: Day-by-day modules covering SQL fundamentals to advanced features.
- 🛠️ MySQL Workbench Ready: Fully formatted
.sqlscripts with explicit delimiter statements for easy execution. - 📝 Annotated Code: Detailed inline comments explaining syntax, execution order, and database logic.
- 🧠 Practical Assignments: Includes dedicated practice problems and query challenges in the
Assignments/folder.
SQL-Handson/
│
├── Day 1.sql # Database & Table Basics (DDL & Basic DML)
├── Day 2.sql # Data Manipulation & Built-in Functions
├── Day 3.sql # Data Analysis, Aggregations & Joins
├── Day 4.sql # Set Operations, Filtering & Stored Procedures
├── Day 5.sql # Advanced Features (Triggers, Window Functions, Views)
├── Assignments/ # Practice sets and assignment queries
└── README.md # Project documentation
| Module | Topic | Core Concepts & Commands |
|---|---|---|
| Day 1.sql | Database & Table Setup | CREATE DATABASE, USE, CREATE TABLE, ALTER, RENAME, DROP, TRUNCATE, INSERT |
| Day 2.sql | Data Updates & Functions | UPDATE, DELETE, SELECT, Numeric, String, and Date/Time Functions |
| Day 3.sql | Data Analysis & Joins | GROUP BY, HAVING, ORDER BY, Inner/Outer JOINS, Aggregations, CASE Statements |
| Day 4.sql | Intermediate Queries | UNION, UNION ALL, LIKE, Pattern Matching, Arithmetic Operators, Stored Procedures |
| Day 5.sql | Advanced SQL Features | Triggers, Window Functions (ROW_NUMBER, RANK, LAG, LEAD), Views |
Make sure you have MySQL Server and MySQL Workbench installed on your machine.
- Download from MySQL Official Downloads
- Clone the repository:
git clone [https://github.com/uga961/SQL-Handson.git](https://github.com/uga961/SQL-Handson.git)
- Launch MySQL Workbench and connect to your MySQL Server instance.
- Open any script file (
File -> Open SQL Script...orCtrl + Shift + O). - Execute the script line-by-line using
Ctrl + Enteror run the whole file usingCtrl + Shift + Enter.
Here is a quick look at the typical execution flow used throughout the scripts:
-- Create and switch to a dedicated working database
CREATE DATABASE IF NOT EXISTS class1;
USE class1;
-- Define table schema
CREATE TABLE student (
student_id INT PRIMARY KEY AUTO_INCREMENT,
student_name VARCHAR(50) NOT NULL,
enrollment_date DATE
);
-- Insert sample records
INSERT INTO student (student_name, enrollment_date)
VALUES ('Alice', CURDATE());
-- Retrieve and analyze data
SELECT * FROM student;
Note: Scripts defining Stored Procedures or Triggers utilize custom
DELIMITER //blocks to ensure smooth execution in MySQL Workbench.
By working through these scripts, you will master:
- Designing schema layouts and executing CRUD operations.
- Writing analytical queries using aggregate functions, groupings, and table joins.
- Performing complex window calculations (
RANK,DENSE_RANK,LAG/LEAD). - Automating database logic using Stored Procedures, Triggers, and reusable Views.
Suggestions, bug fixes, and additional SQL exercises are welcome!
- Fork the repository.
- Create a new branch (
git checkout -b feature/SQL-Challenge). - Commit your enhancements (
git commit -m 'Add new join challenge'). - Push to the branch (
git push origin feature/SQL-Challenge). - Open a Pull Request.
Vaddi Ugandhar
- GitHub: @uga961
Distributed under the MIT License. See LICENSE for details.