Skip to content
Snippets Groups Projects
Commit 7affbba6 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Vorbereitung 16.11.2023

parent 4123014b
Branches
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
% README: Kurzeinführung TCP/IP
% README: Kurzeinführung TCP/IP: X11; Relationale Datenbanken: Einführung in SQL
\documentclass[10pt,t]{beamer}
......
../common/Zeichen_123.pdf
\ No newline at end of file
File added
% dbs-20221116.pdf - Lecture Slides on Databases and Information Security
% Copyright (C) 2023 Peter Gerwinski
%
% This document is free software: you can redistribute it and/or
% modify it either under the terms of the Creative Commons
% Attribution-ShareAlike 3.0 License, or under the terms of the
% GNU General Public License as published by the Free Software
% Foundation, either version 3 of the License, or (at your option)
% any later version.
%
% This document is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this document. If not, see <http://www.gnu.org/licenses/>.
%
% You should have received a copy of the Creative Commons
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
% README: Relationale Datenbanken: Normalformen, Verknüpfungen von Tabellen
\documentclass[10pt,t]{beamer}
\usepackage{pgslides}
\newcommand{\vfilll}{\vspace{0pt plus 1filll}}
\newcommand{\underconstruction}{%
\begin{picture}(0,0)
\put(11,1.2){\makebox(0,0)[b]{\includegraphics[width=1.5cm]{Zeichen_123.pdf}}}
\put(11,0.9){\makebox(0,0)[t]{\shortstack{Änderungen\\vorbehalten}}}
\end{picture}}
\title{Datenbanken und Datensicherheit}
\author{Prof.\ Dr.\ rer.\ nat.\ Peter Gerwinski}
\date{16.\ November 2023}
\begin{document}
\maketitleframe
\nosectionnonumber{\inserttitle}
\begin{frame}
\shownosectionnonumber
\begin{itemize}
\item[\textbf{1}] \textbf{Einführung}
\hfill\makebox(0,0)[br]{\raisebox{2.25ex}{\url{https://gitlab.cvh-server.de/pgerwinski/dbs}}}%
\item[\textbf{2}] \textbf{Kurzeinführung Unix}
\item[\textbf{3}] \textbf{Kurzeinführung TCP/IP}
\begin{itemize}
\vspace*{-\smallskipamount}
\item[\dots]
\item[3.5] Routing
\item[3.6] Netzwerkanalyse
\item[3.7] SSH
\color{medgreen}
\item[3.8] X11
\end{itemize}
\item[\textbf{4}] \textbf{Relationale Datenbanken}
\begin{itemize}
\color{medgreen}
\item[4.1] Einführung in DBMS
\item[4.2] Einführung in SQL
\color{red}
\item[4.3] Normalformen
\item[4.4] Verknüpfungen von Tabellen
\item[\dots]
\end{itemize}
\vspace*{-\smallskipamount}
\item[\textbf{\dots}]
\end{itemize}
\vfilll
\underconstruction
\end{frame}
\setcounter{section}{2}
\section{Kurzeinführung TCP/IP}
\setcounter{subsection}{7}
\subsection{X11}
\begin{frame}
\showsubsection
\begin{itemize}
\item
Grafik-Bildschirm und Eingabegeräte über's Netz
\item
\lstinline[style=cmd]{DISPLAY}-Variable: X-Server: Rechner und Bildschirm
\item
\lstinline[style=cmd]{ssh -X}: X11-Forwarding
\end{itemize}
\end{frame}
\section{Relationale Datenbanken}
\subsection{Einführung in DBMS}
\begin{frame}[fragile]
\showsection
\showsubsection
Datenbank-Management-System (DBMS): z.\,B.\ PostgreSQL
\begin{itemize}
\item Datenbanken "`von außen"' verwalten (z.\,B.\ auflisten)
\item Schnittstelle für Zugriff auf Datenbank
\item \textbf{in hohem Maße herstellerspezifisch}
\end{itemize}
\bigskip
\begin{onlyenv}<1>
\footnotesize
\begin{lstlisting}[style=terminal,gobble=6]
root@cassini:~# ¡su - postgres¿
postgres@cassini:~$ ¡psql¿
psql (15.3 (Debian 15.3-0+deb12u1))
Geben Sie »help« für Hilfe ein.
postgres=# ¡help¿
Dies ist psql, die Kommandozeilenschnittstelle für PostgreSQL.
Geben Sie ein: \copyright für Urheberrechtsinformationen
\h für Hilfe über SQL-Anweisungen
\? für Hilfe über interne Anweisungen
\g oder Semikolon, um eine Anfrage auszuführen
\q um zu beenden
postgres=#
\end{lstlisting}
\vspace*{-3cm}
\end{onlyenv}
\begin{onlyenv}<2>
\footnotesize
\begin{lstlisting}[style=terminal,gobble=6]
postgres=# ¡\?¿
Allgemein
\copyright PostgreSQL-Urheberrechtsinformationen zeigen
\crosstabview [SPALTEN] Anfrage ausführen und Ergebnis als Kreuztabelle
anzeigen
\errverbose letzte Fehlermeldung mit vollen Details anzeigen
\g [(OPT)] [DATEI] SQL-Anweisung ausführen (und Ergebnis in Datei
oder |Pipe schreiben); ...
... ...
\q psql beenden
... ...
postgres=#
\end{lstlisting}
\vspace*{-3cm}
\end{onlyenv}
\begin{onlyenv}<3>
\footnotesize
\begin{lstlisting}[style=terminal,gobble=6]
postgres=# ¡\l¿
Liste der Datenbanken
Name | Eigentümer | Kodierung | Sortierfolge | Zeichentyp |
-----------+------------+-----------+--------------+-------------+- ···
postgres | postgres | UTF8 | de_DE.UTF-8 | de_DE.UTF-8 |
template0 | postgres | UTF8 | de_DE.UTF-8 | de_DE.UTF-8 |
| | | | |
template1 | postgres | UTF8 | de_DE.UTF-8 | de_DE.UTF-8 |
| | | | | ...
(3 Zeilen)
postgres=#
\end{lstlisting}
\vspace*{-3cm}
\end{onlyenv}
\end{frame}
\subsection{Einführung in SQL}
\begin{frame}[fragile]
\showsection
\showsubsection
Datenbank-Abfragesprache: Structured Query Language (SQL)
\begin{itemize}
\item Datenbanken "`von innen"' verwalten, z.\,B.\ anlegen und wieder löschen
\item Daten in der Datenbank bearbeiten
\item \textbf{in hohem Maße standardisiert}
\end{itemize}
\bigskip
\begin{onlyenv}<1>
\footnotesize
\begin{lstlisting}[style=terminal,gobble=6]
postgres=# ¡create database testdb;¿
CREATE DATABASE
postgres=# ¡create user dbs with password '####';¿
CREATE ROLE
postgres=# ¡GRANT ALL ON DATABASE testdb TO dbs;¿
GRANT
postgres=# ¡\q¿
postgres@cassini:~$
\end{lstlisting}
\vspace*{-3cm}
\end{onlyenv}
\begin{onlyenv}<2>
\footnotesize
\begin{lstlisting}[style=terminal,gobble=6]
$ ¡psql -h localhost -U dbs -W testdb¿
Passwort: ¡####¿
psql (15.5 (Debian 15.5-0+deb12u1))
SSL-Verbindung (Protokoll: TLSv1.3, Verschlüsselungsmethode: TLS_AES_256_GCM_SHA384, Komprimierung: aus)
Geben Sie »help« für Hilfe ein.
testdb=> ¡\d¿
Liste der Relationen
Schema | Name | Typ | Eigentümer
--------+------+---------+------------
public | tier | Tabelle | postgres
(1 Zeile)
testdb=>
\end{lstlisting}
\vspace*{-3cm}
\end{onlyenv}
\begin{onlyenv}<3>
\footnotesize
\begin{lstlisting}[style=terminal,gobble=6]
testdb=> ¡\d tier¿
Tabelle »public.tier«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
---------+---------------+--------------+---------------+-------------
name | character(30) | | |
tierart | character(30) | | |
id | integer | | |
testdb=>
\end{lstlisting}
\vspace*{-3cm}
\end{onlyenv}
\end{frame}
\begin{frame}
\showsection
\showsubsection
Datenbank-Abfragesprache: Structured Query Language (SQL)
\bigskip
Literatur: z.\,B.\ \url{https://de.wikibooks.org/wiki/Einführung_in_SQL}
\bigskip
Wichtige SQL-Befehle:
\begin{itemize}
\item
\lstinline[style=cmd]{CREATE} -- Datenbanken, Tabellen usw.\ anlegen
\item
\lstinline[style=cmd]{DROP} -- Datenbanken, Tabellen usw.\ löschen
\item
\lstinline[style=cmd]{SELECT} -- Daten abfragen
\item
\lstinline[style=cmd]{INSERT INTO ... VALUES} -- Daten eingeben
\item
\lstinline[style=cmd]{UPDATE} -- Daten ändern
\item
\lstinline[style=cmd]{DELETE FROM} -- Daten löschen
\end{itemize}
\end{frame}
\subsection{Normalformen}
\begin{frame}
\showsection
\showsubsection
Problem: Schlecht angelegte Datenbanken werden schnell inkonsistent.\\
Beliebte Fehler:
\begin{itemize}
\item
Speichern von mehreren Daten in demselben Tabelleneintrag\\
{\only<2->{\color{red}\textarrow\ 1.~Normalform}}
\item
Speichern von denselben Daten in verschiedenen Tabelleneinträgen\\
{\only<2->{\color{red}\textarrow\ 2.~Normalform}}
\item
implizite Zusammenhänge\\
{\only<2->{\color{red}\textarrow\ 3.~Normalform und Boyce-Codd-Normalform}}
\item
voneinander unabhängige Zusammenhänge in derselben Tabelle\\
{\only<2->{\color{red}\textarrow\ 4.~und 5.~Normalform}}
\end{itemize}
\begin{onlyenv}<2->
\medskip
{\color{red}Lösung: Normalformen}
\end{onlyenv}
\bigskip
Literatur: z.\,B.\ \url{https://de.wikipedia.org/wiki/Normalisierung_(Datenbank)}
\end{frame}
\subsection{Verknüpfungen von Tabellen}
\begin{frame}
\showsection
\showsubsection
Problem: Gut angelegte Datenbanken ({\color{red}\textarrow\ Normalformen})\\
sind stark aufgesplittet.\\
Wie kann man sie weiterhin effizient benutzen?
\bigskip
Lösung: Verknüpfungen von Tabellen
\bigskip
SQL-Befehl: \lstinline[style=cmd]{JOIN}
\bigskip
Literatur: z.\,B.\ \url{https://de.wikipedia.org/wiki/SQL}
\end{frame}
\end{document}
../common/logo-hochschule-bochum-cvh-text-v2.pdf
\ No newline at end of file
../common/logo-hochschule-bochum.pdf
\ No newline at end of file
../common/pgslides.sty
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment