SQL SELECT: Difference between revisions
Jump to navigation
Jump to search
Line 21: | Line 21: | ||
SELECT id, name FROM person WHERE id = 1; | SELECT id, name FROM person WHERE id = 1; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The following query: | |||
<syntaxhighlight lang='sql'> | |||
SELECT; | |||
</syntaxhighlight> | |||
is valid, it returns one empty row. | |||
=Clauses= | =Clauses= |
Revision as of 23:16, 22 May 2024
Internal
Overview
A query consists in at least one (SELECT
) and at most six categories of clauses:
SELECT [...] FROM [...] WHERE [...] GROUP BY [...] HAVING [...] ORDER BY [...];
Upon execution, an SQL query returns a result set.
Select all (possibly across multiple tables) then filter and discard with where.
Example
SELECT id, name FROM person WHERE id = 1;
The following query:
SELECT;
is valid, it returns one empty row.
Clauses
SELECT
FROM
FROM permanent|derived|temporary|virtual(view)
Table alias.