diff --git a/semester4/dmdb/data-modelling-databases-summary.pdf b/semester4/dmdb/data-modelling-databases-summary.pdf index 30f66c3..6422dc9 100644 Binary files a/semester4/dmdb/data-modelling-databases-summary.pdf and b/semester4/dmdb/data-modelling-databases-summary.pdf differ diff --git a/semester4/dmdb/parts/00_relational-model_logic/01_algebra/00_operators.tex b/semester4/dmdb/parts/00_relational-model_logic/01_algebra/00_operators.tex index c88b5c4..beb203c 100644 --- a/semester4/dmdb/parts/00_relational-model_logic/01_algebra/00_operators.tex +++ b/semester4/dmdb/parts/00_relational-model_logic/01_algebra/00_operators.tex @@ -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! diff --git a/semester4/dmdb/parts/01_sql/03_query-language/01_basic-operators.tex b/semester4/dmdb/parts/01_sql/03_query-language/01_basic-operators.tex index 85cd3ad..e3085ea 100644 --- a/semester4/dmdb/parts/01_sql/03_query-language/01_basic-operators.tex +++ b/semester4/dmdb/parts/01_sql/03_query-language/01_basic-operators.tex @@ -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