Complete SQL Concepts Guide
1. Introduction to SQL
SQL (Structured Query Language) is used to communicate with and manage databases. It is the standard
language for relational database management systems.
2. Data Definition Language (DDL)
- CREATE: create new tables or databases
- ALTER: modify existing tables
- DROP: delete tables or databases
- TRUNCATE: delete all rows in a table
3. Data Manipulation Language (DML)
- INSERT: insert new data
- UPDATE: modify existing data
- DELETE: remove data
4. Data Query Language (DQL)
- SELECT: used to fetch data from a database
5. Data Control Language (DCL)
- GRANT: give user access rights
- REVOKE: remove user access rights
6. Transaction Control Language (TCL)
- COMMIT: save changes
- ROLLBACK: undo changes
- SAVEPOINT: set a point for partial rollback
Complete SQL Concepts Guide
7. Constraints
NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK, DEFAULT
8. Joins
INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN, SELF JOIN
9. Subqueries
Nested SELECT statements inside other queries
10. Views
Virtual tables created with SELECT statements
11. Indexes
Used to speed up retrieval of data
12. Stored Procedures & Functions
Reusable SQL blocks stored in the database
13. Triggers
Procedures that automatically run when certain events occur
14. Normalization
Organizing data to reduce redundancy: 1NF, 2NF, 3NF, BCNF
15. Aggregate Functions
SUM, COUNT, AVG, MIN, MAX
Complete SQL Concepts Guide
16. Grouping & Filtering
GROUP BY, HAVING, WHERE
17. Clauses
ORDER BY, LIMIT, OFFSET, DISTINCT
18. Set Operations
UNION, INTERSECT, EXCEPT
19. Case Statements
Used to create conditional logic in queries
20. Window Functions
ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD etc.