mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-09-10 19:15:25 +02:00
[DMDB] Note on sql
This commit is contained in:
Binary file not shown.
@@ -32,8 +32,8 @@
|
|||||||
In other words, $R \div S = T$, with $T$ being the \textit{largest} relation such that $S \times T \subseteq R$.
|
In other words, $R \div S = T$, with $T$ being the \textit{largest} relation such that $S \times T \subseteq R$.
|
||||||
(Find all rows that do not fulfil a condition)
|
(Find all rows that do not fulfil a condition)
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
% TODO: Add other join operations
|
Note that natural joins join on \textit{all} matching columns, i.e. the applied selection uses all matching columns in the predicate,
|
||||||
% TODO: Inequality joins (especially for SQL)
|
which is also how it works in SQL!
|
||||||
|
|
||||||
If we apply set semantics generally, then each operator returns results that adhere to that concept, even Projections!
|
If we apply set semantics generally, then each operator returns results that adhere to that concept, even Projections!
|
||||||
|
|
||||||
|
|||||||
@@ -36,4 +36,9 @@ or in \texttt{WHERE} clauses like this:
|
|||||||
This is referred to as a \bi{Self-Join} and can come in handy when comparing values in a single table,
|
This is referred to as a \bi{Self-Join} and can come in handy when comparing values in a single table,
|
||||||
or to build pairs.
|
or to build pairs.
|
||||||
|
|
||||||
We can use comparison operators also with subqueries containing aggregations, if they return a single result, for multiple results, need \texttt{ANY}, \texttt{ALL}, etc (see above)
|
We can use comparison operators also with subqueries containing aggregations, if they return a single result, for multiple results, need \texttt{ANY}, \texttt{ALL}, etc (see above).
|
||||||
|
|
||||||
|
They are applied as follows:
|
||||||
|
\mint{sql}|SELECT * FROM Products WHERE price = ALL (SELECT Price FROM Products WHERE release_year = 2000)|
|
||||||
|
|
||||||
|
To limit the number of returned tuples, use \texttt{LIMIT N}, where $N$ is to be replaced with any natural number
|
||||||
|
|||||||
Reference in New Issue
Block a user