SQL ClausesΒΆ

Clause

Description

BETWEEN

Simplifies range tests by returning TRUE when the input is within two boundaries

DISTINCT

Returns only unique (distinct) values from a column or a set of columns, eliminating duplicate rows in the result set

EXISTS

Tests for the existence of any rows in a subquery

GROUP BY

Groups rows that have the same values in specified columns into summary rows, like aggregating data

HAVING

Filters groups of rows created by the GROUP BY clause

IN

Tests if an expression is contained in a list of values

Joins

Combine rows from two or more tables, based on a related column between them

LIMIT

Specifies the maximum number of rows that should be returned in the result set

OFFSET

Skips a specified number of rows before returning the result set

ORDER BY

Sorts the result set of a query by one or more columns

UNION [ALL]

Combine the result sets of two or more SELECT statements, removing duplicates

WHERE

Filters records that meet a specified condition