SQL Course Summary
1. Introduction to SQL
- SQL (Structured Query Language) is used to manage and manipulate relational databases.
- Common SQL databases: MySQL, PostgreSQL, SQL Server, SQLite, Oracle.
2. Basic SQL Commands
- SELECT: Retrieve data from tables.
- FROM: Specify the table.
- WHERE: Filter records.
- ORDER BY: Sort results.
- LIMIT: Restrict the number of rows returned.
3. Filtering and Sorting
- Comparison operators: =, <>, >, <, >=, <=
- Logical operators: AND, OR, NOT
- Pattern matching: LIKE, IN, BETWEEN
4. Aggregate Functions
- COUNT(), SUM(), AVG(), MIN(), MAX()
- GROUP BY: Group rows for aggregation.
- HAVING: Filter groups after aggregation.
5. Joins
- INNER JOIN: Matches rows with related data in both tables.
- LEFT JOIN: Includes all rows from the left table.
- RIGHT JOIN: Includes all rows from the right table.
- FULL OUTER JOIN: Includes all rows from both tables.
- SELF JOIN: Join a table with itself.
6. Subqueries
- Nested SELECT statements inside WHERE, FROM, or SELECT clauses.
- Can return scalar values, rows, or tables.
7. Data Modification
- INSERT INTO: Add new records.
- UPDATE: Modify existing records.
- DELETE: Remove records.
8. Table Management
- CREATE TABLE: Define a new table.
- ALTER TABLE: Modify an existing table.
- DROP TABLE: Delete a table.
9. Constraints
- PRIMARY KEY: Unique identifier.
- FOREIGN KEY: Reference to another table.
- UNIQUE, NOT NULL, CHECK, DEFAULT
10. Views and Indexes
- VIEW: Virtual table based on a query.
- INDEX: Improves query performance.
11. Transactions
- BEGIN, COMMIT, ROLLBACK
- Ensures data integrity and supports ACID properties.
12. Advanced Topics (Optional)
- Stored Procedures, Triggers, Window Functions, CTEs (Common Table Expressions)