SQL SELECT: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 4: Line 4:


=Overview=
=Overview=
A query consists in at least one (<code>[[#SELECT|SELECT]]</code>) and at most six categories of [[#Clauses|clauses]]
<font>
[[#SELECT|SELECT]] FROM WHERE GROUP BY HAVING ORDER BY
</font>


Upon execution, an SQL query returns a [[SQL#Result_Set|result set]].
Upon execution, an SQL query returns a [[SQL#Result_Set|result set]].
Line 9: Line 14:
Query execution. SQL optimizer. Subqueries.
Query execution. SQL optimizer. Subqueries.


<font>
SELECT FROM WHERE GROUP BY HAVING ORDER BY
</font>


Select all (possibly across multiple tables) then filter and discard with where.
Select all (possibly across multiple tables) then filter and discard with where.

Revision as of 23:10, 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.

Query execution. SQL optimizer. Subqueries.


Select all (possibly across multiple tables) then filter and discard with where.

Example

SELECT id, name FROM person WHERE id = 1;

Clauses

SELECT

FROM

FROM permanent|derived|temporary|virtual(view)

Table alias.

Querying Multiple Tables

Querying Multiple Tables

WHERE

The WHERE Clause

GROUP BY ... HAVING

(make sure I understand thoroughly and link)

ORDER BY

Subqueries