2.1. DML (Data Manipulation Language)

  • SELECT: The core of SQL.
    • Basic SELECT statement syntax.
    • Using WHERE clauses for filtering (comparison, logical, and range operators).
    • Sorting results with ORDER BY (ASC/DESC).
    • Limiting results (e.g., LIMIT in MySQL/PostgreSQL, TOP in SQL Server).
  • INSERT: Adding new rows to a table.
  • UPDATE: Modifying existing data in a table.
    • UPDATE table SET column = value WHERE ...
  • DELETE: Removing rows from a table.
    • DELETE FROM table WHERE ...

3. The SELECT Statement - The Heart of Querying

  • SELECT column1, column2, ...
  • FROM table_name
  • SELECT * (and why to use it cautiously)
  • The DISTINCT keyword for removing duplicates.
  • Expressions and Aliases: Using AS to rename columns in the output.

4. Filtering Data with the WHERE Clause

  • Comparison Operators: =, <> or !=, >, <, >=, <=
  • Logical Operators: AND, OR, NOT
  • Range Operators: BETWEEN ... AND ...
  • Membership Operator: IN (value1, value2, ...)
  • Pattern Matching: LIKE with wildcards % (any string) and _ (single character).
  • Dealing with NULL: IS NULL, IS NOT NULL