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

Vortragsfolien, Screenshots und Beispiel-SQL-Skripte 23.11.2023

parent b72d4082
Branches
No related tags found
No related merge requests found
Showing
with 2027 additions and 0 deletions
../common/Zeichen_123.pdf
\ No newline at end of file
File added
% dbs-20221123.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: Sichten, Schlüsselfelder, Datensicherung
\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{23.\ 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}
\item[\textbf{4}] \textbf{Relationale Datenbanken}
\begin{itemize}
\item[4.1] Einführung in DBMS
\item[4.2] Einführung in SQL
\color{medgreen}
\item[4.3] Normalformen
\color{orange}
\item[4.4] Verknüpfungen von Tabellen
\color{red}
\item[4.5] Sichten
\item[4.6] Schlüsselfelder
\item[4.7] Datensicherung
\end{itemize}
\vspace*{-\smallskipamount}
\item[\textbf{\dots}]
\end{itemize}
\vfilll
\underconstruction
\end{frame}
\setcounter{section}{3}
\section{Relationale Datenbanken}
\setcounter{subsection}{1}
\subsection{Einführung in SQL}
\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}
\begin{frame}[fragile]
\showsection
\showsubsection
Was machen wir mit Tabelleneinträgen,\\
bei denen die \lstinline[style=cmd]{ON}-Bedingung
nicht erfüllt ist?
\medskip
\begin{lstlisting}[style=terminal]
¡SELECT <Feld[er]> FROM <Tabelle1> [INNER] JOIN <Tabelle2>
ON <Tabelle1>.<Feld> = <Tabelle2>.<Feld>;¿
\end{lstlisting}
\smallskip
\begin{itemize}
\arrowitem
weglassen: \lstinline[style=cmd]{[INNER] JOIN}
\end{itemize}
\medskip
\begin{lstlisting}[style=terminal]
¡SELECT <Feld[er]> FROM <Tabelle1> LEFT JOIN <Tabelle2>
ON <Tabelle1>.<Feld> = <Tabelle2>.<Feld>;¿
\end{lstlisting}
\smallskip
\begin{itemize}
\arrowitem
linke Tabelle trotzdem anzeigen
(mit \lstinline[style=cmd]{NULL}-Einträgen):
\lstinline[style=cmd]{LEFT JOIN}\\
(analog: \lstinline[style=cmd]{RIGHT JOIN} für rechte Tabelle)
\end{itemize}
\medskip
\begin{lstlisting}[style=terminal]
¡SELECT <Feld[er]> FROM <Tabelle1> FULL JOIN <Tabelle2>
ON <Tabelle1>.<Feld> = <Tabelle2>.<Feld>;¿
\end{lstlisting}
\smallskip
\begin{itemize}
\arrowitem
beide Tabellen trotzdem anzeigen
(mit \lstinline[style=cmd]{NULL}-Einträgen):
\lstinline[style=cmd]|FULL JOIN|
\end{itemize}
\end{frame}
\subsection{Sichten}
\begin{frame}[fragile]
\showsection
\showsubsection
\begin{lstlisting}[style=terminal]
¡SELECT <Feld[er]> FROM <Tabelle1> [INNER] JOIN <Tabelle2>
ON <Tabelle1>.<Feld> = <Tabelle2>.<Feld>;¿
\end{lstlisting}
\smallskip
\begin{itemize}
\arrowitem
Wir betrachten beide Tabellen zusammen als eine große Tabelle.
\end{itemize}
\medskip
\begin{lstlisting}[style=terminal]
¡CREATE VIEW <Sicht> AS
SELECT <Feld[er]> FROM <Tabelle1> JOIN <Tabelle2>
ON <Tabelle1>.<Feld> = <Tabelle2>.<Feld>;
SELECT <Feld[er]> FROM <Sicht> [WHERE ...];¿
\end{lstlisting}
\smallskip
\begin{itemize}
\arrowitem
Wir sprechen das Ergebnis genau wie eine Tabelle an.
\bigskip
\arrowitem
Es ist möglich, ohne Verlust an Komfort alle Daten in Normalform zu halten.
\end{itemize}
\end{frame}
\subsection{Schlüsselfelder}
\begin{frame}[fragile]
\showsection
\showsubsection
\begin{lstlisting}[style=terminal]
¡CREATE TABLE tabelle1 (
id INT PRIMARY KEY AUTO_INCREMENT,
...
);
CREATE TABLE tabelle2 (
...
tabelle1_id INT,
...
FOREIGN KEY(tabelle1_id) REFERENCES tabelle1(id)
);
\end{lstlisting}
\smallskip
\begin{itemize}
\arrowitem
Dem DBMS mitteilen, welche Felder für \lstinline[style=cmd]{JOIN}
vorgesehen sind.
\arrowitem
Das DBMS kann mit auf Konsistenz achten.
\end{itemize}
\end{frame}
\subsection{Datensicherung}
\begin{frame}[fragile]
\showsection
\showsubsection
\begin{lstlisting}[style=terminal]
$ ¡pg_dump --clean -h <Rechner> -U <User> -W <Datenbank>¿
\end{lstlisting}
\smallskip
\begin{itemize}
\item
Ausgabe des gesamten Datenbankinhalts\\
als SQL-Quelltext zur Standardausgabe
\arrowitem
keine Probleme mit sich evtl.\ ändernden Binärformaten
\item
Es ist möglich, den Inhalt direkt in einer Pipe weiterzuverarbeiten\\
(z.\,B.\ zu komprimieren).
\item
Zurückspielen: mit \lstinline[style=cmd]{psql}
\end{itemize}
\smallskip
\begin{lstlisting}[style=terminal]
$ ¡psql -h <Rechner> -U <User> -W <Datenbank> \
< <Ausgabe von pg_dump>¿
\end{lstlisting}
\smallskip
\begin{itemize}
\item
analog für \file{MariaDB}: \lstinline[style=cmd]{mariadb-dump}
\end{itemize}
\end{frame}
\end{document}
% dbs-2023ws-p2.pdf - Labor Notes 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: Versuch 2: Relationale Datenbanken
\documentclass[a4paper]{article}
\usepackage{pgscript}
\usepackage{multicol}
\usepackage{sfmath}
\sloppy
\pagestyle{empty}
\addtolength{\textheight}{1cm}
\newcommand{\sep}{~$\cdot$~}
\newcommand{\mylicense}{CC BY-SA (Version 4.0) oder GNU GPL (Version 3 oder höher)}
\begin{document}
\makebox(0,0.005)[tl]{\includegraphics[scale=0.72]{logo-hochschule-bochum-cvh-text-v2.pdf}}\hfill
\makebox(0,0)[tr]{\includegraphics[scale=0.5]{logo-hochschule-bochum.pdf}}
\par\bigskip\bigskip
\begin{center}
\Large\textbf{Praktikumsversuch 2: Relationale Datenbanken}
\par\medskip
\normalsize Datenbanken und Datensicherheit\sep
Wintersemester 2023/24\sep
Prof.~Dr.~Peter Gerwinski
\end{center}
Aufgabe: Schreiben Sie ein Programm, das auf strukturierte Daten zugreift
und diese per TCP/IP kontrolliert zur Verfügung stellt.
\begin{multicols}{2}
\begin{itemize}
\item
Die strukturierten Daten sollen in Gestalt einer Text-Datei zur Verfügung stehen,
z.\,B.\ einer CSV-Datei. Einschränkungen hinsichtlich der Daten,
z.\,B.\ das Ausschließen bestimmter Zeichen aus Strings, sind erlaubt.
\item
Ihr Programm soll über einem TCP-Port
Befehle zur selektiven Datenabfrage entgegennehmen
und die angeforderten Daten über dieselbe TCP-Verbindung ausliefern.
\item
Das Definieren einer für diese Situation angemessenen Abfragesprache
ist Teil der Praktikumsaufgabe.
\item
Implementieren Sie eine Passwort-Abfrage,
über die sich berechtigte Benutzer Ihres Informationssystems
authentifizieren können.
\item
Zusatzaufgabe 1: Implementieren Sie auch Schreibzugriff auf die Text-Datei.
\item
Zusatzaufgabe 2: Demonstrieren Sie, wie sich die Authentifizerung
durch Mitlesen des Netzwerkverkehrs umgehen läßt.
\item
Zusatzaufgabe 3: Gestalten Sie die Authentifizierung so, daß sie sich
durch Mitlesen des Netzwerkverkehrs nicht mehr umgehen läßt.
\end{itemize}
\end{multicols}
\strut\hfill\emph{Viel Erfolg!}
\vfill
\begingroup
\small
\setlength{\leftskip}{3cm}
Stand: 22.\ November 2023
Copyright \copyright\ 2023\quad Peter Gerwinski\\
Lizenz: \mylicense
Sie können diese Praktikumsunterlagen einschließlich \LaTeX-Quelltext
herunterladen unter:\\
\url{https://gitlab.cvh-server.de/pgerwinski/dbs}
\endgroup
\end{document}
testdb=> select * from lied_auf_cd;
cd_id | albumtitel | interpret | gruendungsjahr | erscheinungsjahr | track | titel
-------+--------------------+------------+----------------+------------------+-------+----------------------------
4711 | Not That Kind | Anastacia | 1999 | 2000 | 1 | Not That Kind
4711 | Not That Kind | Anastacia | 1999 | 2000 | 2 | I'm Otta Love
4711 | Not That Kind | Anastacia | 1999 | 2000 | 3 | Cowboys & Kisses
4712 | Wish You Were Here | Pink Floyd | 1965 | 1975 | 1 | Shine On You Crazy Diamond
4713 | Freak of Nature | Anastacia | 1999 | 2001 | 1 | Paid my Dues
(5 Zeilen)
testdb=> select * from lied;
cd_id | track | titel
-------+-------+----------------------------
4711 | 1 | Not That Kind
4711 | 2 | I'm Otta Love
4711 | 3 | Cowboys & Kisses
4712 | 1 | Shine On You Crazy Diamond
4713 | 1 | Paid my Dues
(5 Zeilen)
testdb=> select * from cd;
cd_id | albumtitel | interpret | gruendungsjahr | erscheinungsjahr
-------+--------------------+-------------------------+----------------+------------------
4711 | Not That Kind | Anastacia | 1999 | 2000
4712 | Wish You Were Here | Pink Floyd | 1965 | 1975
4713 | Freak of Nature | Anastacia | 1999 | 2001
4714 | Songs for the Deaf | Queens of the Stone Age | 1996 | 2002
(4 Zeilen)
testdb=> INSERT INTO lied ( cd_id, track, titel ) VALUES ( 4733, 1, '4''33"' ); FEHLER: Einfügen oder Aktualisieren in Tabelle »lied« verletzt Fremdschlüssel-Constraint »lied_fkey_cd_id«
DETAIL: Schlüssel (cd_id)=(4733) ist nicht in Tabelle »cd« vorhanden.
testdb=>
testdb=> \d cd
Tabelle »public.cd«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
------------------+---------+--------------+---------------+-----------------------------------
cd_id | integer | | not null | nextval('cd_cd_id_seq'::regclass)
albumtitel | text | | |
interpret | text | | |
gruendungsjahr | integer | | |
erscheinungsjahr | integer | | |
Indexe:
"cd_pkey" PRIMARY KEY, btree (cd_id)
Fremdschlüsselverweise von:
TABLE "lied" CONSTRAINT "lied_fkey_cd_id" FOREIGN KEY (cd_id) REFERENCES cd(cd_id)
testdb=> \d lied
Tabelle »public.lied«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
--------+---------+--------------+---------------+-------------
cd_id | integer | | |
track | integer | | |
titel | text | | |
Fremdschlüssel-Constraints:
"lied_fkey_cd_id" FOREIGN KEY (cd_id) REFERENCES cd(cd_id)
testdb=>
../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
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cd; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.cd (
cd_id integer,
albumtitel text,
interpret text,
gruendungsjahr integer,
erscheinungsjahr integer
);
ALTER TABLE public.cd OWNER TO dbs;
--
-- Name: lied; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.test (
id integer,
s text
);
ALTER TABLE public.test OWNER TO dbs;
--
-- Name: tier; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.tier (
name character(30),
tierart character(30),
id integer
);
ALTER TABLE public.tier OWNER TO postgres;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
4733 1 4'33"
\.
--
-- Data for Name: test; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.test (id, s) FROM stdin;
7 Zwerge
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze \N
Putzi Ratte \N
\.
--
-- Name: TABLE tier; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON TABLE public.tier TO dbs;
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cd; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.cd (
cd_id integer,
albumtitel text,
interpret text,
gruendungsjahr integer,
erscheinungsjahr integer
);
ALTER TABLE public.cd OWNER TO dbs;
--
-- Name: lied; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.test (
id integer,
s text
);
ALTER TABLE public.test OWNER TO dbs;
--
-- Name: tier; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.tier (
name character(30),
tierart character(30),
id integer
);
ALTER TABLE public.tier OWNER TO postgres;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
4733 1 4'33"
\.
--
-- Data for Name: test; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.test (id, s) FROM stdin;
7 Zwerge
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze \N
Putzi Ratte \N
Felix Troll \N
Rex Ameise \N
\.
--
-- Name: TABLE tier; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON TABLE public.tier TO dbs;
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE public.tier;
DROP TABLE public.test;
DROP VIEW public.lied_auf_cd;
DROP TABLE public.lied;
DROP TABLE public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cd; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.cd (
cd_id integer,
albumtitel text,
interpret text,
gruendungsjahr integer,
erscheinungsjahr integer
);
ALTER TABLE public.cd OWNER TO dbs;
--
-- Name: lied; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.test (
id integer,
s text
);
ALTER TABLE public.test OWNER TO dbs;
--
-- Name: tier; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.tier (
name character(30),
tierart character(30),
id integer
);
ALTER TABLE public.tier OWNER TO postgres;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
4733 1 4'33"
\.
--
-- Data for Name: test; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.test (id, s) FROM stdin;
7 Zwerge
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze \N
Putzi Ratte \N
Felix Troll \N
Rex Ameise \N
\.
--
-- Name: TABLE tier; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON TABLE public.tier TO dbs;
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE public.tier;
DROP VIEW public.lied_auf_cd;
DROP TABLE public.lied;
DROP TABLE public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cd; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.cd (
cd_id integer PRIMARY KEY AUTO_INCREMENT,
albumtitel text,
interpret text,
gruendungsjahr integer,
erscheinungsjahr integer
);
ALTER TABLE public.cd OWNER TO dbs;
--
-- Name: lied; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text,
FOREIGN KEY(cd_id) REFERENCES cd(cd_id)
);
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.tier (
id integer PRIMARY KEY AUTO_INCREMENT,
name text,
tierart text
);
ALTER TABLE public.tier OWNER TO dbs;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
4733 1 4'33"
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze \N
Putzi Ratte \N
Felix Troll \N
Rex Ameise \N
\.
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE public.tier;
DROP VIEW public.lied_auf_cd;
DROP TABLE public.lied;
DROP TABLE public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cd; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.cd (
cd_id integer SERIAL PRIMARY KEY;
albumtitel text,
interpret text,
gruendungsjahr integer,
erscheinungsjahr integer
);
ALTER TABLE public.cd OWNER TO dbs;
--
-- Name: lied; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text,
FOREIGN KEY(cd_id) REFERENCES cd(cd_id)
);
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.tier (
id integer SERIAL PRIMARY KEY,
name text,
tierart text
);
ALTER TABLE public.tier OWNER TO dbs;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
4733 1 4'33"
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze \N
Putzi Ratte \N
Felix Troll \N
Rex Ameise \N
\.
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE IF EXISTS public.tier;
DROP VIEW IF EXISTS public.lied_auf_cd;
DROP TABLE IF EXISTS public.lied;
DROP TABLE IF EXISTS public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cd; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.cd (
cd_id SERIAL PRIMARY KEY,
albumtitel text,
interpret text,
gruendungsjahr integer,
erscheinungsjahr integer
);
ALTER TABLE public.cd OWNER TO dbs;
--
-- Name: lied; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied
ADD CONSTRAINT FOREIGN KEY(cd_id) REFERENCES public.cd(cd_id);
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.tier (
id SERIAL PRIMARY KEY,
name text,
tierart text
);
ALTER TABLE public.tier OWNER TO dbs;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
4733 1 4'33"
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze \N
Putzi Ratte \N
Felix Troll \N
Rex Ameise \N
\.
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE IF EXISTS public.tier;
DROP VIEW IF EXISTS public.lied_auf_cd;
DROP TABLE IF EXISTS public.lied;
DROP TABLE IF EXISTS public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cd; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.cd (
cd_id SERIAL PRIMARY KEY,
albumtitel text,
interpret text,
gruendungsjahr integer,
erscheinungsjahr integer
);
ALTER TABLE public.cd OWNER TO dbs;
--
-- Name: lied; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied
ADD CONSTRAINT lied_fkey_cd_id FOREIGN KEY(cd_id) REFERENCES public.cd(cd_id);
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.tier (
id SERIAL PRIMARY KEY,
name text,
tierart text
);
ALTER TABLE public.tier OWNER TO dbs;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
4733 1 4'33"
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze 5
Putzi Ratte 6
Felix Troll 7
Rex Ameise 8
\.
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE IF EXISTS public.tier;
DROP VIEW IF EXISTS public.lied_auf_cd;
DROP TABLE IF EXISTS public.lied;
DROP TABLE IF EXISTS public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cd; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.cd (
cd_id SERIAL PRIMARY KEY,
albumtitel text,
interpret text,
gruendungsjahr integer,
erscheinungsjahr integer
);
ALTER TABLE public.cd OWNER TO dbs;
--
-- Name: lied; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied
ADD CONSTRAINT lied_fkey_cd_id FOREIGN KEY(cd_id) REFERENCES public.cd(cd_id);
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.tier (
id SERIAL PRIMARY KEY,
name text,
tierart text
);
ALTER TABLE public.tier OWNER TO dbs;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze 5
Putzi Ratte 6
Felix Troll 7
Rex Ameise 8
\.
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE IF EXISTS public.tier;
DROP VIEW IF EXISTS public.lied_auf_cd;
DROP TABLE IF EXISTS public.lied;
DROP TABLE IF EXISTS public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
CREATE TABLE public.cd (
cd_id SERIAL PRIMARY KEY,
albumtitel text,
interpret_id integer,
erscheinungsjahr integer
);
CREATE TABLE public.interpret (
id SERIAL PRIMARY KEY,
name Text,
gruendungsjahr INTEGER
);
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied
ADD CONSTRAINT lied_fkey_cd_id FOREIGN KEY(cd_id) REFERENCES public.cd(cd_id);
ALTER TABLE public.cd OWNER TO dbs;
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.tier (
id SERIAL PRIMARY KEY,
name text,
tierart text
);
ALTER TABLE public.tier OWNER TO dbs;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze 5
Putzi Ratte 6
Felix Troll 7
Rex Ameise 8
\.
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE IF EXISTS public.tier;
DROP VIEW IF EXISTS public.lied_auf_cd;
DROP TABLE IF EXISTS public.lied;
DROP TABLE IF EXISTS public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
CREATE TABLE public.cd (
cd_id SERIAL PRIMARY KEY,
albumtitel text,
interpret_id integer,
erscheinungsjahr integer
);
CREATE TABLE public.interpret (
id SERIAL PRIMARY KEY,
name Text,
gruendungsjahr INTEGER
);
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied
ADD CONSTRAINT lied_fkey_cd_id FOREIGN KEY(cd_id) REFERENCES public.cd(cd_id);
ALTER TABLE public.cd
ADD CONSTRAINT cd_fkey_interpret_id FOREIGN KEY(interpret_id) REFERENCES public.interpret(id);
ALTER TABLE public.cd OWNER TO dbs;
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.tier (
id SERIAL PRIMARY KEY,
name text,
tierart text
);
ALTER TABLE public.tier OWNER TO dbs;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze 5
Putzi Ratte 6
Felix Troll 7
Rex Ameise 8
\.
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.5 (Debian 15.5-0+deb12u1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-0+deb12u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP TABLE IF EXISTS public.tier;
DROP VIEW IF EXISTS public.lied_auf_cd;
DROP TABLE IF EXISTS public.lied;
DROP TABLE IF EXISTS public.cd;
SET default_tablespace = '';
SET default_table_access_method = heap;
CREATE TABLE public.cd (
cd_id SERIAL PRIMARY KEY,
albumtitel text,
interpret_id integer,
erscheinungsjahr integer
);
CREATE TABLE public.interpret (
id SERIAL PRIMARY KEY,
name Text,
gruendungsjahr INTEGER
);
CREATE TABLE public.lied (
cd_id integer,
track integer,
titel text
);
ALTER TABLE public.lied
ADD CONSTRAINT lied_fkey_cd_id FOREIGN KEY(cd_id) REFERENCES public.cd(cd_id);
ALTER TABLE public.cd
ADD CONSTRAINT cd_fkey_interpret_id FOREIGN KEY(interpret_id) REFERENCES public.interpret(id);
ALTER TABLE public.cd OWNER TO dbs;
ALTER TABLE public.lied OWNER TO dbs;
--
-- Name: lied_auf_cd; Type: VIEW; Schema: public; Owner: dbs
--
CREATE VIEW public.lied_auf_cd AS
SELECT cd.cd_id,
cd.albumtitel,
cd.interpret_id,
cd.gruendungsjahr,
cd.erscheinungsjahr,
lied.track,
lied.titel
FROM (public.cd
JOIN public.lied ON ((cd.cd_id = lied.cd_id)));
ALTER TABLE public.lied_auf_cd OWNER TO dbs;
--
-- Name: test; Type: TABLE; Schema: public; Owner: dbs
--
CREATE TABLE public.tier (
id SERIAL PRIMARY KEY,
name text,
tierart text
);
ALTER TABLE public.tier OWNER TO dbs;
--
-- Data for Name: cd; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.cd (cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr) FROM stdin;
4711 Not That Kind Anastacia 1999 2000
4712 Wish You Were Here Pink Floyd 1965 1975
4713 Freak of Nature Anastacia 1999 2001
4714 Songs for the Deaf Queens of the Stone Age 1996 2002
\.
--
-- Data for Name: lied; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.lied (cd_id, track, titel) FROM stdin;
4711 1 Not That Kind
4711 2 I'm Otta Love
4711 3 Cowboys & Kisses
4712 1 Shine On You Crazy Diamond
4713 1 Paid my Dues
\.
--
-- Data for Name: tier; Type: TABLE DATA; Schema: public; Owner: dbs
--
COPY public.tier (name, tierart, id) FROM stdin;
Esmeralda Spinne 1
Timmy Hund 2
Dio Katze 3
Tusnelda Spinne 4
Ragnar Katze 5
Putzi Ratte 6
Felix Troll 7
Rex Ameise 8
\.
--
-- PostgreSQL database dump complete
--
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment