SQL Keywords and Descriptions
1. Data Query Keywords
SELECT: Retrieves data from a table
FROM: Specifies the table to query data from
WHERE: Filters records that meet a condition
DISTINCT: Returns unique values
ORDER BY: Sorts result set (ASC or DESC)
GROUP BY: Groups rows that have the same values
HAVING: Filters groups (used with GROUP BY)
LIMIT: Specifies the number of rows to return (MySQL)
TOP: Limits the number of returned rows (SQL Server)
2. Data Manipulation Keywords (DML)
INSERT INTO: Adds new records to a table
VALUES: Specifies the values for an INSERT
UPDATE: Modifies existing data
SET: Defines column values in UPDATE
DELETE: Removes records from a table
3. Data Definition Keywords (DDL)
CREATE: Creates a database/table/index/view
TABLE: Refers to table object
ALTER: Modifies an existing table
DROP: Deletes a table or database
TRUNCATE: Removes all data but keeps structure
PRIMARY KEY: Declares a unique identifier for rows
FOREIGN KEY: Declares a reference to another table
AUTO_INCREMENT: Automatically increases integer value (MySQL)
NOT NULL: Prevents null values in a column
DEFAULT: Sets a default value for a column
4. Constraints & Conditions
AND / OR: Combines multiple conditions
IN: Matches values in a list
BETWEEN: Matches a range of values
LIKE: Pattern matching (e.g., LIKE 'A%')
IS NULL: Checks for null values
UNIQUE: Ensures all values in a column are different
CHECK: Ensures a condition is true for a column
5. Joins and Set Operators
JOIN: Combines rows from two tables
INNER JOIN: Returns records with matching values in both tables
LEFT JOIN: All from left + matches from right
RIGHT JOIN: All from right + matches from left
FULL JOIN: All records when there is a match in one of the tables
ON: Specifies join condition
UNION: Combines results of two SELECTs (no duplicates)
UNION ALL: Same as UNION but includes duplicates
6. Transaction Control (TCL)
COMMIT: Saves the transaction permanently
ROLLBACK: Undoes changes since last commit
SAVEPOINT: Sets a point to roll back to
TRANSACTION: Starts a database transaction
7. Data Control (DCL)
GRANT: Gives user access privileges
REVOKE: Removes access privileges
8. Miscellaneous
AS: Renames a column or table with an alias
CASE: Conditional expressions (like if-else)
EXISTS: Checks if a subquery returns any rows
ANY / ALL: Compares a value to a list/subquery
INDEX: Improves query performance
VIEW: Creates a virtual table based on a query