\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{tarinya} \pdfinfo{ /Title (dbs1.pdf) /Creator (Cheatography) /Author (tarinya) /Subject (Dbs1 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{187838} \definecolor{LightBackground}{HTML}{F7FAF8} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Dbs1 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{tarinya} via \textcolor{DarkBackground}{\uline{cheatography.com/25055/cs/6582/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}tarinya \\ \uline{cheatography.com/tarinya} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 31st January, 2016.\\ Updated 7th January, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DB Entwurfsprozess}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452449645_Screen Shot 2016-01-10 at 19.13.31.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Abbildungsregeln}} \tn % Row 0 \SetRowColor{LightBackground} 1..* & PK von 1 ist FK von * \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} n:m & Beziehungstabelle mit zusammengesetztem PK (FK der beiden Tabellen) \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ANSI-3 Ebenenmodell}} \tn % Row 0 \SetRowColor{LightBackground} externen Ebene & Sicht einer Benutzerklasse auf eine Teilmenge der Datenbank \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{konzeptionelle} Ebene & logische Struktur der Daten \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} interne Ebene & Speicherungsstrukturen \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Vorteile: einzelne Bereiche umstrukturieren, ohne Auswirkungen auf restliche Teile} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DDL (Data Definition)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452424834_createtable.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{CREATE database/view | ALTER, DROP | ...references a(a) ON DELETE CASCADE/SET NULL} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DML (Data Manipulation)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{DELETE FROM angestellter WHERE persNr=1100; \newline INSERT INTO Abteilung (Name, AbtrNr) VALUES ('Entwicklung', 20); \newline UPDATE test SET name = "a" WHERE id=1;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DQL // JOINs}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{SELECT PZ.PersNr, proj.bezeichnung, Zeitanteil, ang.Name FROM projektZuteilung AS PZ \newline INNER JOIN angestellter AS ang ON ang.PersNr = PZ.PersNr \newline INNER JOIN projekt AS proj ON PZ.ProjNr=proj.ProjNr \newline WHERE (PZ.ProjNr=25) OR (PZ.ProjNr=30) \newline ORDER BY proj.ProjNr, ang.Name;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DQL // Subqueries}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{SELECT Name FROM Angestellter A WHERE EXISTS \newline ( SELECT * FROM ProjektZuteilung WHERE PersNr = A.PersNr ); \newline \newline SELECT ang.Name, Salaer \newline FROM Angestellter as ang INNER JOIN Abteilung as abt ON abt.AbtNr=ang.AbtNr WHERE abt.Name='Entwicklung' AND Salaer = \newline ( SELECT MIN (Salaer) \newline FROM Angestellter as ang INNER JOIN Abteilung as abt ON abt.AbtNr=ang.AbtNr WHERE abt.Name='Entwicklung');} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{korreliert = subquery ist abh{\"a}ngig, i.e. nicht alleine ausführbar \newline unkorreliert = subquery unabh{\"a}ngig} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DQL // Aggregatfunktionen}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{SELECT MAX( Salaer ) FROM Angestellter; \newline SELECT MIN( Salaer ) FROM Angestellter; \newline SELECT AVG( Salaer ) FROM Angestellter; \newline SELECT SUM( Salaer ) AS "Salaersumme" FROM Angestellter; SELECT SELECT name, COUNT(projnr) from projektzuteilung inner join angestellter on projektzuteilung.persnr = angestellter.persnr group by name;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{zur einschr{\"a}nkung nicht WHERE sondern {\bf{HAVING}}! \newline nur attribute in group by k{\"o}nnen verwendet werden. \newline `..having count(*) \textless{} 2; ..having name like 'M\%`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Data Control Language (DCL)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{CREATE ROLE user WITH LOGIN PASSWORD 'pw'; \newline ALTER ROLE user CREATEROLE, CREATEDB; \newline DROP ROLE AngProj;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Index}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Index-Sequential Access Method (ISAM) \newline % Row Count 1 (+ 1) - Daten über Indexspalten asc sortiert \newline % Row Count 2 (+ 1) + Einfügen/Suchen: schnell \newline % Row Count 3 (+ 1) - aktualisieren: schlecht \newline % Row Count 4 (+ 1) B-Baum (Balanced) \newline % Row Count 5 (+ 1) - für grosse Datenmengen% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Heap (=Java Linked List) \newline Suchbaum (=Java Tree) \newline `CREATE INDEX \textless{}IndexName\textgreater{} ON \textless{}Table(attr)\textgreater{};` \newline Index lohnt sich für : Schlüssel, H{\"a}ufiger Vergl. mit Konstanten (zb Jahr = 2000)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{B-Tree einfügen}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452448508_b-tree.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Window Functions}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{//alle namen mit sal{\"a}r\&differenz zum n{\"a}chsten \newline SELECT name, salaer, (salaer - lead(salaer, 1) OVER(ORDER BY salaer desc)) AS "differenz" FROM angestellter ORDER BY 2 DESC LIMIT 5; \newline //alle Vor-\&Nachnamen mit ihrer Anzahl \newline SELECT nachname, vorname, COUNT(*) OVER (PARTITION BY vorname) AS Anzahl FROM person;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Funktionen, die auf ein „Daten-Fenster" (d.h. umgebende Tupel bezogen auf die aktuelle Zeile) angewendet werden. Ähnlich wie AggregatsF. aber Zeilen behalten separaten Informationsgehalt} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Common Table Expressions (CTE)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{WITH angestelltemitprojekten AS ( \newline SELECT a.name, proj.bezeichnung \newline FROM angestellter a \newline JOIN projzut pz ON a.persnr=pz.persnr \newline JOIN projekt proj ON pz.projnr=proj.projnr \newline ) \newline SELECT * FROM angestelltemitprojekten;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{CTE's ("WITH" Queries) ermöglichen Definition von Hilfs-Queries in bzw. vor einer grösseren Query} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Views}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{CREATE VIEW AngPublic (Persnr, Name, Tel, Wohnort) AS \newline SELECT Persnr, Name, Tel, Wohnort FROM Angestellter; \newline SELECT * FROM AngPublic ORDER BY Name; \newline DROP VIEW AngPublic;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{virtuelle Tabelle, basierend auf anderen Tabellen/Views. \newline werden mit Select-Anweisung definiert \newline Nutzen: Datenkapselung, \seqsplit{Benutzeranpassung(Vereinfachung)}, Datenschutz} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Transactions}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{BEGIN ISOLATION LEVEL SERIALIZABLE; \newline SAVEPOINT one; \newline ROLLBACK TO one; \newline COMMIT;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Isolationslvl: \newline Read Uncommitted = read nicht synch. \newline Read Committed = read nur kurz synch. \newline Repeatable Read = zugegr. rows sind synch. \newline Serializable = vollst{\"a}. Isolation} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Isolationsfehler}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452443509_isolationsfehler.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Dirty = Lese Daten von anderer nicht committed Transaktion \newline Fuzzy = Lese gleiche Daten mehrmals -{}-\textgreater{} andere Werte \newline Phantom = Select entdecke plötzlich neue/gelöschte Rows} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Serialisierbarkeitsgraph}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452442794_serialisierbarkeitsgraph.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{BibliotheksDB}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452449791_Screen Shot 2016-01-10 at 19.15.53.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{UML}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452603434_Screen Shot 2016-01-12 at 13.56.43.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Locking}} \tn % Row 0 \SetRowColor{LightBackground} 2-Phase Locking & Sobald die Transaktion ein Lock freigegeben hat, darf sie keine weiteren Locks beziehen \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} Strict 2-Phase Locking & Alle gehaltenen Sperren werden erst nach Ende der Transaktion freigegeben \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} xlock & Exclusive Lock für schreibe-/lesezugriff \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} slock & Shared Lock für lesezugriff \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{wenn slock(x) vergeben, muss andere Transaktion mit xlock(x) warten} \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.58804 cm} x{2.38896 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Anforderungen Datenbank}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Redundanzfreiheit} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Datenintegrit{\"a}t & Datenkonsistenz \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} & Datensicherheit \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} & Datenschutz \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Datenunabh{\"a}ngigkeit} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{DBMS Funktionen: Transaktionen, Mehrbenutzerbetrieb, Sicherheit, BackUp/Recovery} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{ACID-Kriterien}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452505251_acid.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Voraussetzung für Verl{\"a}sslichkeit von Systemen und Transaktionen} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Relationale Schreibweise}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Tabellenname (id INTEGER PK, \newline name TEXT(20) NOT NULL, \newline abteilung NOT NULL REFERENCES abteilung);} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{PK attribute unterrstreichen \newline FK attribute kursiv oder gestrichelt unterstreichen} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Normalformen}} \tn % Row 0 \SetRowColor{LightBackground} 1.NF & Attriutwerte atomar \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} 2. NF & Nichtschlüsselattribut von Schlüssel voll funktional abh{\"a}ngig\{\{nl\}\}Attribut muss vom ganzen Schlüssel abh{\"a}ngen nicht nur von Teilen\{\{nl\}\}i.e. PK aus 1 Attribut -{}-\textgreater{} immer 2.NF \tn % Row Count 8 (+ 7) % Row 2 \SetRowColor{LightBackground} \{Autor\} -\textgreater{} \{Adresse\} & Adresse von Autor funktional abh{\"a}ngig, lesen: "bestimmt eindeutig" \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} 3. NF & kein Nichtschlüsselattribut von Schlüssel transitiv abh{\"a}ngig \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Nutzen: Redundanzen erkennen \& Anomalien (Einfüge-, L{\"o}sch-, Änderungs-) verhindern \newline Determinante: min. Attributmenge, von der andere Attr. funktional abh{\"a}ngen \newline zb ISBN | Ausleiher | Autor -{}-\textgreater{} Determinante ISBN} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{NF Bsp}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1454054495_Screen Shot 2016-01-29 at 09.01.10.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Relationale Algebra}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452602452_rel.algebra.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JDBC}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452448640_jdbc.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JDBC Isolationslevel}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452615374_Screen Shot 2016-01-12 at 17.16.00.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{SQL Injections / Prepared Statement}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452449154_Screen Shot 2016-01-10 at 19.05.27.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Probleml{\"o}sung: 1)prepared statements verwenden 2)Benutzerrechte m{\"o}glichst einschr{\"a}nken 3) SQL steuerzeichen escapen (aus ' ; -{}-\textgreater{} \textbackslash{}' \textbackslash{}; )} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JDBC update}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452448726_jdbc update.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JDBC MetaData}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/tarinya_1452602739_Screen Shot 2016-01-12 at 13.43.37.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{connection.getMetaData() =\textgreater{} DatabaseMetaData, gibt Infos über DB (Produktename,Driver,unterstützte Datentypen...)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}