Keyword | Purpose | Remarks |
---|---|---|
SELECT | Retrieve data from the database | |
FROM | Specify the table to select data from | |
WHERE | Filter rows based on a condition | |
AS | Rename a column or table with an alias | |
JOIN | Combine rows from two or more tables ON Specify the condition for a JOIN |
|
AND | Combine multiple conditions, all must be true | |
OR | Combine multiple conditions, at least one must be true | |
LIMIT | Restrict the number of rows returned | |
IN | Specify multiple values in a WHERE clause | |
CASE | Create conditional logic within a SQL statement |
| IS NULL | Check for empty or NULL values |ORDER BY | Sort the result set by one or more columns |GROUP BY | Group rows that share a property into summary rows |HAVING | Filter groups based on conditions |INSERT INTO |Add new records to a table |VALUES | Specify values to insert into the table |UPDATE | Modify existing records in a table |SET | Specify the columns and values to update |DELETE | Remove records from a table |ALTER | Modify the structure of a table (e.g., add or drop columns) DROP # Delete tables, databases, or indexes |DISTINCT | Retrieve unique values from a column |TRUNCATE | Delete all records from a table (but keep the structure) UNION # Combine the result sets of two or more SELECT queries