SQL Beast Logo
SQL Glossary

SQL Keywords Explorer

Familiarize yourself with SQL keywords. Inspect command structures, study basic syntaxes, and copy simple examples to learn SQL fundamentals.

SELECTData Retrieval

Retrieves rows and columns from one or more database tables.

Syntax ModelSELECT column1, column2 FROM table_name;
Usage ExampleSELECT first_name, salary FROM employees;
INSERTData Modification

Adds new records (rows) to an existing database table.

Syntax ModelINSERT INTO table_name (col1, col2) VALUES (val1, val2);
Usage ExampleINSERT INTO departments (dept_name, floor) VALUES ('Marketing', 3);
UPDATEData Modification

Modifies existing columns in table rows matching condition filters.

Syntax ModelUPDATE table_name SET col1 = val1 WHERE condition;
Usage ExampleUPDATE employees SET status = 'active' WHERE id = 104;
DELETEData Modification

Removes rows from a table based on a matching filter condition.

Syntax ModelDELETE FROM table_name WHERE condition;
Usage ExampleDELETE FROM session_logs WHERE log_date < NOW() - INTERVAL 30 DAY;
WHEREFiltering

Applies boolean logic conditions to filter rows returned by queries.

Syntax ModelSELECT cols FROM table WHERE logical_condition;
Usage ExampleSELECT * FROM products WHERE price > 49.99 AND in_stock = 1;
GROUP BYAggregation

Aggregates subsets of matching rows together into summary groups based on shared column values.

Syntax ModelSELECT col, aggregate_func(col2) FROM table GROUP BY col;
Usage ExampleSELECT country, COUNT(customer_id) FROM customers GROUP BY country;
HAVINGFiltering

Filters aggregated grouping scopes (behaves like WHERE, but evaluated after GROUP BY aggregations).

Syntax ModelSELECT col FROM table GROUP BY col HAVING aggregate_condition;
Usage ExampleSELECT category, SUM(sales) FROM products GROUP BY category HAVING SUM(sales) > 10000;
ORDER BYSorting

Sorts row output based on one or more columns in ascending (ASC) or descending (DESC) directions.

Syntax ModelSELECT cols FROM table ORDER BY col [ASC|DESC];
Usage ExampleSELECT employee_id, salary FROM employees ORDER BY salary DESC, last_name ASC;
JOINRelational Joins

Combines columns from two database tables using matched relational join key columns.

Syntax ModelSELECT cols FROM t1 JOIN t2 ON t1.key = t2.key;
Usage ExampleSELECT o.order_id, c.customer_name FROM orders o JOIN customers c ON o.cust_id = c.id;
CTE (WITH)Advanced Querying

Defines temporary result queries that act like local query scopes, improving multi-join readability.

Syntax ModelWITH cte_name AS (SELECT cols FROM table) SELECT cols FROM cte_name;
Usage ExampleWITH active_users AS (SELECT id FROM users WHERE status = 'active') SELECT * FROM active_users;
DISTINCTFiltering

Eliminates duplicate rows from query results, returning only unique values.

Syntax ModelSELECT DISTINCT column_name FROM table_name;
Usage ExampleSELECT DISTINCT job_title FROM employees;
TRUNCATEData Definition

Empty all row values in a target table instantly. Faster than DELETE as it bypasses triggers.

Syntax ModelTRUNCATE TABLE table_name;
Usage ExampleTRUNCATE TABLE session_caches;