Explore tens of thousands of sets crafted by our community.
SQL Clauses and Operators
20
Flashcards
0/20
SELECT
Used to retrieve data from a database. It specifies the columns to be returned in the result set.
FROM
Specifies the table from which to retrieve data.
WHERE
Filters the data returned by a SQL query, based on a specified condition.
JOIN
Combines rows from two or more tables, based on a related column between them.
ORDER BY
Sorts the result set in either ascending or descending order.
GROUP BY
Arranges identical data into summary rows. Typically used with aggregate functions (COUNT, MAX, MIN, SUM, AVG).
HAVING
Used instead of WHERE with aggregate functions. Filters the data after the aggregation.
LIMIT
Restricts the number of rows returned by a query. Useful in pagination.
UNION
Combines the result-set of two or more SELECT statements, only includes distinct values.
UNION ALL
Similar to UNION, but includes duplicates. Combines the result-sets of multiple SELECT statements.
AND
Logical operator that combines two or more conditions in a WHERE clause, all conditions must be true.
OR
Logical operator that combines two or more conditions in a WHERE clause, at least one condition must be true.
NOT
Logical operator used to negate a condition in a WHERE clause.
IN
Allows you to specify multiple values in a WHERE clause. Works like multiple OR conditions.
LIKE
Operator used in a WHERE clause to search for a specified pattern in a column.
BETWEEN
Operator selecting values within a range, used in WHERE clause. The range includes the endpoints.
AS
Used to rename a column or table with an alias. This alias is used to make column names more readable.
DISTINCT
Used with SELECT to remove duplicate rows in the result set. Only distinct (different) values are selected.
CASE
Used to create conditional logic within a SQL query. Functions like an if-then-else statement.
EXISTS
Used in a WHERE clause to test for the existence of any record in a subquery.
© Hypatia.Tech. 2024 All rights reserved.