Data Manipulation Language – SQL
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_nameSELECT *(and why to use it cautiously)- The
DISTINCTkeyword for removing duplicates. - Expressions and Aliases: Using
ASto 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:
LIKEwith wildcards%(any string) and_(single character). - Dealing with
NULL:IS NULL,IS NOT NULL