mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-09-10 19:15:25 +02:00
[DMDB] Intuition for FD and NF
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
\subsubsection{Keys}
|
||||
\label{sec:relations-keys}
|
||||
\inlinedefinition[Candidate Key] The minimal set of fields that identify each tuple uniquely
|
||||
\inlinedefinition[Candidate Key] The minimal set of fields that identify each tuple uniquely (non-duplicate attributes (fields) typically)
|
||||
|
||||
\inlinedefinition[Primary Key] A single candidate key, i.e. just a single field.
|
||||
We mark the primary key using \underline{underlining} in visual \glspl{schema}.
|
||||
Formally, we write $R(\underline{k : D_k}, a:D_a, b:D_b)$ for a given relation, with all valid instances fulfilling
|
||||
\[
|
||||
I \subseteq D_k \times D_a \times D_b \land \forall (k, a, b), (k', a', b') \in I : k = k' \rightarrow (a, b) = (a', b')
|
||||
I \subseteq D_k \times D_a \times D_b \land \forall (k, a, b), (k', a', b') \in I : k = k' \rightarrow (a, b) = (a', b')
|
||||
\]
|
||||
i.e. if the key is equal, so is the rest of the tuple (thus they are one and the same\footnote{\hlhref{https://www.youtube.com/watch?v=tGeSEbYzhBU}{Heidrun is her name}}).
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
\newpage
|
||||
\subsubsection{Closure Algorithm}
|
||||
For the definition of the closure, see above.
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
\subsubsection{Intuition}
|
||||
Adapted from the \hlhref{https://en.wikipedia.org/wiki/Functional_dependency}{Wikipedia Article on this topic}
|
||||
|
||||
The idea of functional dependencies is to describe which attributes belong to the \textit{determinant set} $X$ and which belong to the \textit{dependent set} $Y$.
|
||||
The values of the attributes in the \textit{determinant set} determine the values of $Y$.
|
||||
|
||||
Thus, for a relation $R$, with $X, Y \subseteq R$, with $X \rightarrow Y$:
|
||||
\begin{itemize}
|
||||
\item When attributes $X$ have known values (let's call them $\bm{x}$),
|
||||
then the values of for their corresponding $Y$ attributes can be determined by looking them up in \bi{any} tuple of $R$ containing the values $\bm{x}$
|
||||
\item Two tuples sharing the same values of $X$ share the same values of $Y$.
|
||||
\end{itemize}
|
||||
A FD $X \rightarrow Y$ is \textit{trivial}, if $Y \subseteq X$
|
||||
@@ -1,4 +1,4 @@
|
||||
\subsection{Second Normal Form}
|
||||
\subsubsection{Second Normal Form}
|
||||
% The two dependencies $\{ \text{Legi}, \text{Nr} \} \rightrightarrow \{ \text{Name}, \text{Semester} \}$,
|
||||
% $\{ \text{Legi} \} \rightrightarrow \{ \text{Name}, \text{Semester} \}$ state the following:
|
||||
%
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
\subsubsection{Overview}
|
||||
This overview is adapted from \hlhref{https://en.wikipedia.org/wiki/Database_normalization\#Normal_forms}{this Wikipedia article}.
|
||||
All constraint definitions in {\scriptsize smaller font} are informal. Note that \textit{prime attributes} are the attributes that make up a candidate key,
|
||||
also known as \textit{key attributes}
|
||||
|
||||
\newcommand{\cross}{\ding{55}}
|
||||
\begin{tables}{p{10cm}lllll}{Constraint & UNF & 1NF & 2NF & 3NF & BCNF}
|
||||
Unique rows {\scriptsize (no duplicates)}
|
||||
& \checkmark & \checkmark & \checkmark & \checkmark & \checkmark \\
|
||||
Scalar Columns {\scriptsize (Columns can't contain relations or composite values)}
|
||||
& \cross & \checkmark & \checkmark & \checkmark & \checkmark \\
|
||||
Every non-prime attribute has a full FD on each candidate key {\scriptsize (Attributes depend on the whole of every key)}
|
||||
& \cross & \cross & \checkmark & \checkmark & \checkmark \\
|
||||
Every Non-trivial FD begins either with superkey or ends with prime attribute {\scriptsize (Attributes depend only on candidate keys)}
|
||||
& \cross & \cross & \cross & \checkmark & \checkmark \\
|
||||
Every non-trivial FD begins with a superkey
|
||||
& \cross & \cross & \cross & \checkmark & \checkmark \\
|
||||
\end{tables}
|
||||
@@ -7,6 +7,7 @@
|
||||
\input{parts/02_theory-background/00_functional-dependencies/03_other-rules.tex}
|
||||
\input{parts/02_theory-background/00_functional-dependencies/04_closure.tex}
|
||||
\input{parts/02_theory-background/00_functional-dependencies/05_using.tex}
|
||||
\input{parts/02_theory-background/00_functional-dependencies/06_intuition.tex}
|
||||
% \input{parts/02_theory-background/00_functional-dependencies/}
|
||||
|
||||
\input{parts/02_theory-background/01_normal-forms/00_intro.tex}
|
||||
@@ -16,6 +17,7 @@
|
||||
\input{parts/02_theory-background/01_normal-forms/04_bncf.tex}
|
||||
\input{parts/02_theory-background/01_normal-forms/05_decomposition-algorithm.tex}
|
||||
\input{parts/02_theory-background/01_normal-forms/06_synthesis-algorightm.tex}
|
||||
\input{parts/02_theory-background/01_normal-forms/07_overview.tex}
|
||||
% \input{parts/02_theory-background/01_normal-forms/}
|
||||
|
||||
% \input{parts/02_theory-background/}
|
||||
|
||||
Reference in New Issue
Block a user