2013-07-30 11:17:53 +02:00
\documentclass [a4paper] { scrartcl}
2013-07-27 15:28:36 +02:00
\usepackage { amssymb, amsmath} % needed for math
\usepackage [utf8] { inputenc} % this is needed for umlauts
\usepackage [ngerman] { babel} % this is needed for umlauts
\usepackage [T1] { fontenc} % this is needed for correct output of umlauts in pdf
\usepackage { pdfpages} % Signatureinbingung und includepdf
\usepackage { geometry} % [margin=2.5cm]layout
\usepackage { hyperref} % links im text
\usepackage { color}
\usepackage { framed}
\usepackage { enumerate} % for advanced numbering of lists
\usepackage { marvosym} % checkedbox
\usepackage { wasysym}
\usepackage { braket} % for \Set{}
\usepackage { pifont} % http://ctan.org/pkg/pifont
\usepackage { minted} % needed for the inclusion of source code
2013-07-28 15:55:54 +02:00
\usepackage { tikz}
\usetikzlibrary { arrows,positioning, calc,lindenmayersystems,decorations.pathmorphing,intersections}
\tikzstyle { vertex} =[draw,
fill=yellow,
circle,minimum size=10pt,inner sep=0pt]
2013-07-27 15:28:36 +02:00
\newcommand { \cmark } { \ding { 51} } %
\newcommand { \xmark } { \ding { 55} } %
\hypersetup {
pdfauthor = { Martin Thoma} ,
pdfkeywords = { Datenbanksysteme,KIT} ,
pdftitle = { Musterlösung: Datenbanksysteme}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin document %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin { document}
\section { Aufgabe D1 - ER-Modellierung}
\subsection { Teilaufgabe a)}
2013-07-30 11:17:53 +02:00
\begin { tabular} { p{ 12cm} cc}
2013-07-27 15:28:36 +02:00
& Richtig & Falsch\\
Es kann Gutachter geben, die keiner Konferenz zugewiesen sind & \Square & \Checkedbox \\
Es ist sichergestellt, dass eine Publikation von mehreren Gutachtern bewertet wird. & \Checkedbox & \Square \\
Jede Konferenz besitzt zugewiesene Gutachter & \Square & \Checkedbox \\
Jeder Autor steht über seine Publikationen mit mindestens drei Gutachtern in Verbindung. & \Checkedbox & \Square \\
Es kann auch Konferenzen geben, auf denen nichts veröffentlicht wird. & \Checkedbox & \Square \\
Es gilt immer: $ N ( Publikationen ) \geq N ( Autor ) $ & \Square & \Checkedbox \\
Es gilt immer: $ N ( Konferenz ) \geq N ( Publikation ) $ & \Square & \Checkedbox \\
Es gilt immer: $ N ( Gutachter ) \geq N ( Publikation ) $ & \Checkedbox & \Square \\
\end { tabular}
\subsection { Teilaufgabe b)}
2013-07-28 15:55:54 +02:00
ER-Modelierung ist kapazitätserhöhend? (Beispiel? TODO)
2013-07-30 11:17:53 +02:00
\clearpage
2013-07-27 15:28:36 +02:00
\section { Aufgabe D2 - Normalformen}
\subsection { Teilaufgabe a)}
2013-07-28 15:55:54 +02:00
$ A $ ist Schlüsselkandidat.
2013-07-27 15:28:36 +02:00
\subsection { Teilaufgabe b)}
$ R = \Set { \underline { A } , B, C, D } $ hat
\begin { itemize}
\item 1NF, da jedes Attribut atomar ist
\item 2NF, da es bein einem einzelnen Attribut als Schlüssel niemals ein Nicht-Schlüssel von einer Teilmenge abhängig sein kann
\item nicht 3NF, da $ A \rightarrow B \rightarrow C $ . Der Nicht-Schlüssel $ C $ ist also vom Schlüssel $ A $ transitiv abhängig.
\end { itemize}
\subsection { Teilaufgabe c)}
2013-07-30 11:17:53 +02:00
\begin { tabular} { lcp{ 1cm} p{ 2cm} p{ 5cm} }
Zerlegung & 3NF & ver\- bund\- treu & ab\- hängigkeits\- treu & Bemerkung\\
2013-07-27 15:28:36 +02:00
\hline
2013-07-28 15:55:54 +02:00
$ S _ 1 = \Set { \underline { A } BC, \underline { C } D } $ & \xmark & \xmark & \xmark & nur 2NF, da $ A \rightarrow B \rightarrow C $ \newline Im Schnitt ist nur $ C $ , aber $ C \nrightarrow ABC $ und $ C \nrightarrow CD $ \newline $ C \rightarrow D $ ist nicht in $ F $ \\
$ S _ 2 = \Set { \underline { A } B, \underline { B } C, \underline { C } D } $ & \cmark & \xmark & \xmark & $ C \rightarrow D $ ist nicht in $ F $ \newline Gegenbeispiel für verbundtreue gefunden\\
2013-07-27 15:28:36 +02:00
$ S _ 3 = \Set { \underline { A } B, \underline { B } CD } $ & \cmark & \cmark & \cmark & \\
2013-07-28 15:55:54 +02:00
$ S _ 4 = \Set { \underline { A } B, \underline { C } D } $ & \cmark & \xmark & \xmark & $ C \rightarrow D $ nicht in $ F $ \newline nicht verbundtreu, da beide Relation nur per Natural Join verbunden werden können
2013-07-27 15:28:36 +02:00
\end { tabular}
2013-07-30 11:17:53 +02:00
\clearpage
2013-07-27 15:28:36 +02:00
\section { Aufgabe D3 - SQL}
\subsection { Teilaufgabe a)}
\includegraphics [width=0.7\textwidth] { d3.pdf}
\subsection { Teilaufgabe b)}
\inputminted [linenos, numbersep=5pt, tabsize=4] { sql} { d3b.sql}
Problem: Nun kann es auch Kunden geben, die gar nicht beraten werden!
\subsection { Teilaufgabe c)}
\inputminted [linenos, numbersep=5pt, tabsize=4] { sql} { d3c.sql}
\subsection { Teilaufgabe d)}
\inputminted [linenos, numbersep=5pt, tabsize=4] { sql} { d3d.sql}
\subsection { Teilaufgabe e)}
\inputminted [linenos, numbersep=5pt, tabsize=4] { sql} { d3e.sql}
\section { D4 - Transaktionen und Histories}
\subsection { Teilaufgabe a)}
2013-07-28 15:55:54 +02:00
\begin { tikzpicture} [scale=1.2]
\node (T1)[vertex] at (1,2) { $ T _ 1 $ } ;
\node (T2)[vertex] at (2,2) { $ T _ 2 $ } ;
\node (T3)[vertex] at (3,1) { $ T _ 3 $ } ;
\node (T4)[vertex] at (2,0) { $ T _ 4 $ } ;
\node (T5)[vertex] at (1,0) { $ T _ 5 $ } ;
\foreach \from /\to in { T1/T2, T4/T5, T4/T3, T4/T2, T3/T1, T5/T1}
\draw [line width=1.5pt,->] (\from ) -- (\to );
\end { tikzpicture}
\subsection { Teilaufgabe b) und c)}
\begin { tabular} { l|lll}
~ & RC & ACA & ST \\ \hline
$ T _ 4 $ reads $ d $ from $ T _ 3 $ & \cmark & \cmark & \cmark \\
$ T _ 4 $ reads $ c $ from $ T _ 2 $ & \cmark & \cmark & \cmark \\
$ T _ 1 $ reads $ a $ from $ T _ 2 $ & \cmark & \cmark & \cmark \\
\end { tabular}
2013-07-27 15:28:36 +02:00
\subsection { Teilaufgabe d)}
2013-07-28 16:13:27 +02:00
Eine History $ H $ ist $ ST \Leftrightarrow w _ j ( x ) < o _ i ( x ) : i \neq j \Rightarrow a _ j < o _ i ( x ) \lor c _ j < o _ i ( x ) $ , wobei $ o _ i ( x ) \in \Set { r _ i ( x ) , w _ i ( x ) } $
2013-07-27 15:28:36 +02:00
\subsection { Teilaufgabe e)}
2013-07-30 20:39:07 +02:00
$ w _ 5 [ b ] $ hinter $ c _ 4 $ verschieben
2013-07-28 15:55:54 +02:00
2013-07-27 15:28:36 +02:00
\end { document}