SQL Keywords Explorer
Familiarize yourself with SQL keywords. Inspect command structures, study basic syntaxes, and copy simple examples to learn SQL fundamentals.
Retrieves rows and columns from one or more database tables.
SELECT column1, column2 FROM table_name;SELECT first_name, salary FROM employees;Adds new records (rows) to an existing database table.
INSERT INTO table_name (col1, col2) VALUES (val1, val2);INSERT INTO departments (dept_name, floor) VALUES ('Marketing', 3);Modifies existing columns in table rows matching condition filters.
UPDATE table_name SET col1 = val1 WHERE condition;UPDATE employees SET status = 'active' WHERE id = 104;Removes rows from a table based on a matching filter condition.
DELETE FROM table_name WHERE condition;DELETE FROM session_logs WHERE log_date < NOW() - INTERVAL 30 DAY;Applies boolean logic conditions to filter rows returned by queries.
SELECT cols FROM table WHERE logical_condition;SELECT * FROM products WHERE price > 49.99 AND in_stock = 1;Aggregates subsets of matching rows together into summary groups based on shared column values.
SELECT col, aggregate_func(col2) FROM table GROUP BY col;SELECT country, COUNT(customer_id) FROM customers GROUP BY country;Filters aggregated grouping scopes (behaves like WHERE, but evaluated after GROUP BY aggregations).
SELECT col FROM table GROUP BY col HAVING aggregate_condition;SELECT category, SUM(sales) FROM products GROUP BY category HAVING SUM(sales) > 10000;Sorts row output based on one or more columns in ascending (ASC) or descending (DESC) directions.
SELECT cols FROM table ORDER BY col [ASC|DESC];SELECT employee_id, salary FROM employees ORDER BY salary DESC, last_name ASC;Combines columns from two database tables using matched relational join key columns.
SELECT cols FROM t1 JOIN t2 ON t1.key = t2.key;SELECT o.order_id, c.customer_name FROM orders o JOIN customers c ON o.cust_id = c.id;Defines temporary result queries that act like local query scopes, improving multi-join readability.
WITH cte_name AS (SELECT cols FROM table) SELECT cols FROM cte_name;WITH active_users AS (SELECT id FROM users WHERE status = 'active') SELECT * FROM active_users;Eliminates duplicate rows from query results, returning only unique values.
SELECT DISTINCT column_name FROM table_name;SELECT DISTINCT job_title FROM employees;Empty all row values in a target table instantly. Faster than DELETE as it bypasses triggers.
TRUNCATE TABLE table_name;TRUNCATE TABLE session_caches;