SELECT Statement
The SELECT
statement retrieves rows from one or more tables or views. It is the most commonly used SQL command for querying data.
Syntax
SELECT [DISTINCT]
column1, column2, …
FROM table_name
[WHERE condition]
[GROUP BY column_list]
[HAVING condition]
[ORDER BY column_list [ASC|DESC]];
All clauses are optional except SELECT
and FROM
. Use DISTINCT
to eliminate duplicate rows.