SQL for Data Science — Day-wise Topics
(Revised & Teacher-Friendly)
Day 1 – Introduction to SQL & Databases
Objective: Understand the basics of data, information, databases, and SQL.
- What is SQL?
- Difference between Data and Information
- What is a Database?
- Different types of Databases (Hierarchical, Network, Relational, NoSQL)
- How data is generated in real-world applications
- Brief history of Databases & SQL - Installing MySQL (or any chosen RDBMS)
Practice Task: Install MySQL and create your first database.
Day 2 – Basic SQL Structure & DBMS Concepts
Objective: Learn how SQL works and the structure of basic commands.
- SQL Syntax & Structure
- Difference between DBMS vs RDBMS
- Structured vs Unstructured Data
- Introduction to Tables - Types of SQL Commands (DDL, DML, DQL, DCL, TCL
— Overview) - Run your first SQL query
Practice Task: Create a table students and insert sample data.
Day 3 – Data Types & Creating Database Objects
Objective: Learn different SQL data types and how to create databases &
tables.
- SQL Data Types (Numeric, Character, Date/Time, Boolean)
- Creating Databases - Creating Tables - Understanding how SQL queries
work - Writing queries in a structured way
Practice Task: Create a table with all major data types.
Day 4 – SQL Commands (DDL, DML, DQL, DCL, TCL)
Objective: Understand the types of SQL commands with examples.
1. DDL (Data Definition Language) – CREATE, ALTER, DROP, TRUNCATE
2. DML (Data Manipulation Language) – INSERT, UPDATE, DELETE
3. DQL (Data Query Language) – SELECT
4. DCL (Data Control Language) – GRANT, REVOKE
5. TCL (Transaction Control Language) – COMMIT, ROLLBACK,
SAVEPOINT
Day 5 – Constraints
Objective: Learn how to enforce rules on table data.
- What are Constraints? - PRIMARY KEY - FOREIGN KEY - UNIQUE - DEFAULT -
CHECK - AUTO INCREMENT
Day 6 – Operators & Functions
Objective: Use operators and built-in functions in SQL.
- Comparison Operators (=, <, >, <>, <=, >=)
- Arithmetic Operators (+, -, *, /, %)
- Logical Operators (AND, OR, NOT)
- Special Operators (LIKE, IN, IS NULL, BETWEEN, DISTINCT)
- Built-in Functions: COUNT, SUM, AVG, MIN, MAX
Practice Task: Query student marks using operators and functions.
Day 7 – String & Date Functions
Objective: Work with text and date data effectively.
- String Functions (LENGTH, UPPER, LOWER, CONCAT, SUBSTRING, TRIM)
- Date Functions (NOW, CURDATE, DATEDIFF, YEAR, MONTH, DAY)
Day 8– SQL Clauses
Objective: Learn essential SQL clauses.
- SELECT, FROM, WHERE
- GROUP BY, HAVING
- ORDER BY - LIMIT, OFFSET
Practice Task: Query top 5 highest student scores.
Day 9 – Normalization
Objective: Understand database normalization.
- What is Normalization?
- 1st Normal Form (1NF)
- 2nd Normal Form (2NF)
- 3rd Normal Form (3NF)
Practice Task: Normalize a denormalized student dataset.
Day 10–13 – SQL Joins
Objective: Learn how to combine data from multiple tables.
- Day 10: Introduction to Joins (INNER, LEFT, RIGHT, FULL, CROSS, SELF)
- Day 11: INNER JOIN, LEFT JOIN, RIGHT JOIN (Hands-on)
- Day 12: FULL JOIN, SELF JOIN, CROSS JOIN (Hands-on)
- Day 13: Using Joins in UPDATE & DELETE, using Clauses with Joins
Day 14–15 – Subqueries
Objective: Learn different types of subqueries.
- Day 14: Introduction,
Single-row Subqueries
Multi-row Subqueries
Multi-column Subqueries
- Day 15: Correlated Subqueries, Nested Subqueries
Day 16–17 – Window Functions
Objective: Use window functions for advanced analytics.
- Day 16: RANK(), DENSE_RANK(), ROW_NUMBER()
- Day 17: LEAD, LAG, NTILE, Window Functions with Aggregation
Day 18 – Transactions & Security
Objective: Learn transaction control and data security.
- DCL Commands: GRANT, REVOKE
- TCL Commands: SAVEPOINT, ROLLBACK, COMMIT
Day 19– Advanced SQL
Objective: Work with advanced SQL concepts.
- CASE Statements
- CTE (Common Table Expressions)
Day 20 – Indexes
Objective: Learn how indexes improve performance.
- What is an Index?
- How to Create Index
- How to Drop Index
- When to Use Indexes
.
Day 21 – Views
Objective: Simplify queries with views.
- Simple Views
- Complex Views
- Materialized Views
Day 22–23 – Triggers
Objective: Automate actions with triggers.
- Day 22: AFTER INSERT, AFTER UPDATE, AFTER DELETE
- Day 23: BEFORE INSERT, BEFORE UPDATE, BEFORE DELETE
Day 24–25 – Stored Procedures
Objective: Learn to create and use stored procedures.
- Day 24: Introduction, Creating Stored Procedures, Parameters
- Day 25: IN, OUT, INOUT Parameters, Error Handling