[DMDB] Note on sql

This commit is contained in:
2026-08-16 12:14:29 +02:00
parent e220b0b992
commit 9809b27e89
3 changed files with 8 additions and 3 deletions
@@ -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$.
(Find all rows that do not fulfil a condition)
\end{itemize}
% TODO: Add other join operations
% TODO: Inequality joins (especially for SQL)
Note that natural joins join on \textit{all} matching columns, i.e. the applied selection uses all matching columns in the predicate,
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!
@@ -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,
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