This repository contains hands-on SQL practice tasks and database operations performed during NAVTTC training sessions and personal learning. The examples cover various database concepts such as DDL, DML, sequences, auto-increment, window functions, importing data from CSV, and more using MySQL.
- Create employee and role tables
- Insert multiple records
- Use
SELECT,INSERT,ROW_NUMBER(),DISTINCT, etc. - Populate role table using
SELECT FROM
- Demonstrates use of
AUTO_INCREMENT - Attempts to simulate
SEQUENCEbehavior in MySQL
- Insert bulk records
- Practice data types like
DECIMAL,CHAR,INT - Basic table creation and constraints
- Use
CREATE TABLE AS SELECT - Use
SELECT ... INTOto copy data conditionally
- Create table for Netflix Movies
- Use
LOAD DATA INFILEto import a CSV file into MySQL
- MySQL 8.x
- MySQL Workbench / phpMyAdmin
- CSV File Handling
- Use MySQL Workbench or any MySQL terminal.
- Run each SQL command block inside a valid database.
- For CSV import, make sure the file path is correct and permissions are allowed.
- The
CREATE SEQUENCEsyntax is included for comparison, although MySQL doesn't support SEQUENCE like Oracle/PostgreSQL β instead,AUTO_INCREMENTis used. - Use of
ROW_NUMBER()and variables like@rownumis shown for generating ranks or ordered results.
You can split these SQL blocks into multiple .sql files, like:
employees.sqlpersons.sqlcustomers.sqlnetflix_import.sql
...or keep it all in a single file like sql_practice_labs.sql.
Sidra Bibi
SQL & Data Science Learner
Sir Syed University of Engineering & Technology