SQL Commands
-
What are the main categories of SQL commands?
Category Commands DDL CREATE, ALTER, DROP DML INSERT, UPDATE, DELETE DQL SELECT DCL GRANT, REVOKE TCL BEGIN, COMMIT, ROLLBACK Filtering WHERE, IN, BETWEEN, LIKE Aggregation COUNT, SUM, AVG, MIN, MAX Grouping GROUP BY, HAVING Sorting ORDER BY, LIMIT Set operations UNION, INTERSECT, EXCEPT -
What are the join types?
INNER, LEFT, RIGHT, FULL and CROSS JOIN.
-
What are views?
Named queries that expose results as a virtual table.
-
What are indexes?
Data structures that improve certain queries at the cost of storage and write overhead.
-
What types of SQL functions are available?
String manipulation, mathematical functions, date-time operations, pattern matching and type conversion.
-
What are some recommended practices?
Use parameterized queries and carefully restrict UPDATE and DELETE operations.
Example
SELECT category_id,
SUM(amount_cents) AS total
FROM expenses
GROUP BY category_id
HAVING SUM(amount_cents) > 10000
ORDER BY total DESC;Reference
SQL Commands by Pandeeswari M. Examples use PostgreSQL-compatible syntax.