SQL Tutorial
SQL Tutorial
SQL Tutorial
1. Introduction to SQL
Structured Query Language (SQL) is a standard language for managing and manipulating
relational databases.
Example:
Example:
Example:
INSERT INTO employees (id, name, age, department) VALUES (1, 'John Doe', 28,
'HR');
Example:
Remove records:
Example:
5.1. Joins
Left Join:
Right Join:
Perform calculations:
o COUNT: Count rows.
o SUM: Total values.
o AVG: Average value.
o MAX/MIN: Highest/lowest value. Example:
5.3. Subqueries
Nested queries:
SELECT column FROM table WHERE column IN (SELECT column FROM another_table);
7. Indexing
Improve query performance:
8. Transactions
BEGIN TRANSACTION;
-- SQL statements
COMMIT;
ROLLBACK;
9. Views
Books: “SQL in 10 Minutes” by Ben Forta, “SQL Practice Problems” by Sylvia Moestl
Vasilik.
Online Platforms: Codecademy, LeetCode, HackerRank.
Communities: Stack Overflow, SQLServerCentral, Reddit’s r/SQL.
14. Certifications