DQL
DQL is used for reading or querying data or table metadata. SQL statements involving SELECT
and SHOW
fall under this category.
SELECT
is a very commonly used SQL syntax to read table data. It takes the following parameters:
ALL
: Doesn't eliminate duplicate rows.DISTINCT
: Eliminates duplicate rows.DISTINCT ON
(a_expression
): Eliminates duplicate rows based on a scalar expression.target_element
: A scalar expression to determine a column in each result row, or to retrieve all columns in case of an asterisk (*
).table_expression
: A table expression from which the data has to be retrieved.AS OF SYSTEM TIME
timestamp
: Retrieves data as it existed at the time of this timestamp, wheretimestamp
refers to a specific time in the past. This can return historical data, which can be stale.WHERE a_expression
: Only retrieves rows that returnTRUE
fora_expression
.GROUP BY a_expression
: Groups results on one or more columns. ...