From 8da8d3de0eb6042f2c2fa6af6390125ce4458d8c Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sat, 7 Mar 2026 11:37:16 +0100 Subject: [PATCH] [DMDB] Notes for this week --- semester4/dmdb/parts/00_sql/01_operations.tex | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/semester4/dmdb/parts/00_sql/01_operations.tex b/semester4/dmdb/parts/00_sql/01_operations.tex index 72b44ff..5e6adff 100644 --- a/semester4/dmdb/parts/00_sql/01_operations.tex +++ b/semester4/dmdb/parts/00_sql/01_operations.tex @@ -17,3 +17,13 @@ We can directly add new columns to our result using statements like (also note that we do not actually return salary and employment columns) \mint{sql}{SELECT name, salary * employment / 100 AS RealSalary FROM employees;} + +When applying \texttt{GROUP BY}, COUNT and the like operate on each group, not entire dataset. + +\texttt{NATURAL JOIN} doesn't require a ON clause (it looks for columns with same name) + +After \texttt{GROUP BY} we can't use \texttt{WHERE}, instead we can use \texttt{HAVING}, which operates on groups instead of on rows. + +We can compare against a query with a single result column and row using a \texttt{WHERE} clause. + +The \texttt{CROSS JOIN} is the both-sided extension to \texttt{LEFT JOIN} and \texttt{RIGHT JOIN}