A collection of MySQL queries organized by category, written as part of my university Database Lab coursework.
I'm currently learning and actively building this repository — more content will be added as I progress. 🚀
Atiq ur Rehman
Roll No: 24p-3002 | Section: SE-4A
🔗 LinkedIn | GitHub
MySQL/
└── sql queries/
├── tables.sql # CREATE & ALTER TABLE statements (DDL)
├── user_management.sql # CREATE USER & GRANT privileges (DCL)
├── insertion.sql # INSERT INTO statements (DML)
├── updation.sql # UPDATE & DELETE statements (DML)
├── aggregate.sql # Aggregate functions & GROUP BY (DQL)
├── Joins.sql # INNER, LEFT & SELF JOINs (DQL)
├── functions.sql # String & Date functions (DQL)
└── filtering.sql # WHERE, LIKE, BETWEEN, IN, NOT IN (DQL)
📌 Note: This structure will grow over time. New folders and files will be added as I cover more topics.
CREATE DATABASEandCREATE TABLEwith constraintsALTER TABLE— MODIFY columns, ADD constraints, DROP columns- Primary keys, NOT NULL, UNIQUE, CHECK constraints
CREATE USERwith passwordsGRANTprivileges — SELECT, INSERT, ALL PRIVILEGESWITH GRANT OPTIONfor admin-level accessSHOW GRANTSfor verifying user permissions
- Inserting records into multiple related tables
- customers, employees, suppliers, products, orders, order_details
UPDATEwith conditions and JOIN- Bulk updates using
WHEREclauses
COUNT,SUM,AVG,MAX,MINGROUP BYandHAVINGclauses- Subqueries with aggregate functions
INNER JOINacross multiple tablesLEFT JOINto include unmatched records- Self Join for hierarchical data (employee → manager)
- String:
UPPER,LOWER,CONCAT,SUBSTRING,LENGTH - Date:
CURDATE,YEAR,TIMESTAMPDIFF
WHERE,LIKEwith wildcards (%)BETWEEN,IN,NOT IN- Pattern matching on text and date columns
- MySQL — Database engine
- phpMyAdmin — GUI for running and testing queries
- Git & GitHub — Version control and sharing
🔄 In Progress — This repository is actively being updated.
More topics coming soon: Views, Stored Procedures, Triggers, Indexes, and real-world datasets.
This is a personal learning repo, but if you're a fellow student and find it helpful — feel free to star ⭐ it or fork it for your own practice!
Made with 💻 and lots of SQL errors along the way.