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

Screenshots 18.12.2024

parent 6de3a517
No related branches found
No related tags found
No related merge requests found
File moved
File moved
testdb=> select * from kuenstler;
id | interpret | gruendungsjahr
-----+------------+----------------
311 | Anastacia | 1999
312 | Pink Floyd | 1965
(2 Zeilen)
testdb=> insert into kuenstler values ( 313, 'Beethoven', 1770 );
INSERT 0 1
testdb=> select * from kuenstler;
id | interpret | gruendungsjahr
-----+------------+----------------
311 | Anastacia | 1999
312 | Pink Floyd | 1965
313 | Beethoven | 1770
(3 Zeilen)
testdb=> select c.id, c.albumtitel, k.gruendungsjahr, c.erscheinungsjahr, l.track, l.titel from cd as c left join kuenstler as k on c.interpret = k.id left join lied as l on c.id = l.id;
id | albumtitel | gruendungsjahr | erscheinungsjahr | track | titel
------+--------------------+----------------+------------------+-------+----------------------------
4711 | Not That Kind | 1999 | 2000 | 1 | Not That Kind
4712 | Wish You Were Here | 1965 | 1975 | 1 | Shine On You Crazy Diamond
4713 | Freak of Nature | 1999 | 2001 | 1 | Paid my Dues
4711 | Not That Kind | 1999 | 2000 | 3 | Cowboys & Kisses
4711 | Not That Kind | 1999 | 2000 | 2 | I'm Outta Love
4714 | leere CD | 1770 | 2024 | |
(6 Zeilen)
testdb=> update kuenstler set id = 314 where id = 313;
UPDATE 1
testdb=> select * from kuenstler; id | interpret | gruendungsjahr
-----+------------+----------------
311 | Anastacia | 1999
312 | Pink Floyd | 1965
314 | Beethoven | 1770
(3 Zeilen)
testdb=> select c.id, c.albumtitel, k.gruendungsjahr, c.erscheinungsjahr, l.track, l.titel from cd as c left join kuenstler as k on c.interpret = k.id left join lied as l on c.id = l.id;
id | albumtitel | gruendungsjahr | erscheinungsjahr | track | titel
------+--------------------+----------------+------------------+-------+----------------------------
4711 | Not That Kind | 1999 | 2000 | 1 | Not That Kind
4712 | Wish You Were Here | 1965 | 1975 | 1 | Shine On You Crazy Diamond
4713 | Freak of Nature | 1999 | 2001 | 1 | Paid my Dues
4711 | Not That Kind | 1999 | 2000 | 3 | Cowboys & Kisses
4711 | Not That Kind | 1999 | 2000 | 2 | I'm Outta Love
4714 | leere CD | | 2024 | |
(6 Zeilen)
testdb=> select c.id, c.albumtitel, k.gruendungsjahr, c.erscheinungsjahr, l.track, l.titel from cd as c right join kuenstler as k on c.interpret = k.id left join lied as l on c.id = l.id;
id | albumtitel | gruendungsjahr | erscheinungsjahr | track | titel
------+--------------------+----------------+------------------+-------+----------------------------
4711 | Not That Kind | 1999 | 2000 | 1 | Not That Kind
4712 | Wish You Were Here | 1965 | 1975 | 1 | Shine On You Crazy Diamond
4713 | Freak of Nature | 1999 | 2001 | 1 | Paid my Dues
4711 | Not That Kind | 1999 | 2000 | 3 | Cowboys & Kisses
4711 | Not That Kind | 1999 | 2000 | 2 | I'm Outta Love
| | 1770 | | |
(6 Zeilen)
testdb=> select c.id, c.albumtitel, k.gruendungsjahr, c.erscheinungsjahr, l.track, l.titel from cd as c right join kuenstler as k on c.interpret = k.id right join lied as l on c.id = l.id;
id | albumtitel | gruendungsjahr | erscheinungsjahr | track | titel
------+--------------------+----------------+------------------+-------+----------------------------
4711 | Not That Kind | 1999 | 2000 | 1 | Not That Kind
4712 | Wish You Were Here | 1965 | 1975 | 1 | Shine On You Crazy Diamond
4713 | Freak of Nature | 1999 | 2001 | 1 | Paid my Dues
4711 | Not That Kind | 1999 | 2000 | 3 | Cowboys & Kisses
4711 | Not That Kind | 1999 | 2000 | 2 | I'm Outta Love
(5 Zeilen)
testdb=>
testdb=> SELECT * FROM lied;
id | track | titel
------+-------+----------------------------
4711 | 1 | Not That Kind
4712 | 1 | Shine On You Crazy Diamond
4713 | 1 | Paid my Dues
4711 | 3 | Cowboys & Kisses
4711 | 2 | I'm Outta Love
(5 Zeilen)
testdb=> INSERT INTO lied VALUES ( 4714, 0, 'Alle meine Entchen' );
INSERT 0 1
testdb=> SELECT * FROM lied;
id | track | titel
------+-------+----------------------------
4711 | 1 | Not That Kind
4712 | 1 | Shine On You Crazy Diamond
4713 | 1 | Paid my Dues
4711 | 3 | Cowboys & Kisses
4711 | 2 | I'm Outta Love
4714 | 0 | Alle meine Entchen
(6 Zeilen)
testdb=> select c.id, c.albumtitel, k.gruendungsjahr, c.erscheinungsjahr, l.track, l.titel from cd as c right join kuenstler as k on c.interpret = k.id right join lied as l on c.id = l.id;
id | albumtitel | gruendungsjahr | erscheinungsjahr | track | titel
------+--------------------+----------------+------------------+-------+----------------------------
4711 | Not That Kind | 1999 | 2000 | 1 | Not That Kind
4712 | Wish You Were Here | 1965 | 1975 | 1 | Shine On You Crazy Diamond
4713 | Freak of Nature | 1999 | 2001 | 1 | Paid my Dues
4711 | Not That Kind | 1999 | 2000 | 3 | Cowboys & Kisses
4711 | Not That Kind | 1999 | 2000 | 2 | I'm Outta Love
| | | | 0 | Alle meine Entchen
(6 Zeilen)
testdb=> SELECT c.id, c.albumtitel, k.gruendungsjahr, c.erscheinungsjahr, l.track, l.titel FROM cd AS c FULL kuenstler as k on c.interpret = k.id right join lied as l on c.id = l.id;
testdb=> SELECT c.id, c.albumtitel, k.gruendungsjahr, c.erscheinungsjahr, l.track, l.titel FROM cd AS c FULL JOIN kuenstler AS k ON c.interpret = k.id FULL JOIN lied AS l ON c.id = l.id;
id | albumtitel | gruendungsjahr | erscheinungsjahr | track | titel
------+--------------------+----------------+------------------+-------+----------------------------
4711 | Not That Kind | 1999 | 2000 | 1 | Not That Kind
4712 | Wish You Were Here | 1965 | 1975 | 1 | Shine On You Crazy Diamond
4713 | Freak of Nature | 1999 | 2001 | 1 | Paid my Dues
4711 | Not That Kind | 1999 | 2000 | 3 | Cowboys & Kisses
4711 | Not That Kind | 1999 | 2000 | 2 | I'm Outta Love
4714 | leere CD | | 2024 | 0 | Alle meine Entchen
| | 1770 | | |
(7 Zeilen)
testdb=> UPDATE lied SET id = 4715 WHERE id = 4714;
FEHLER: Einfügen oder Aktualisieren in Tabelle »lied« verletzt Fremdschlüssel-Constraint »lied_fkey«
DETAIL: Schlüssel (id)=(4715) ist nicht in Tabelle »cd« vorhanden.
testdb=> UPDATE lied SET id = NULL WHERE id = 4714;
UPDATE 1
testdb=> SELECT * FROM lied;
id | track | titel
------+-------+----------------------------
4711 | 1 | Not That Kind
4712 | 1 | Shine On You Crazy Diamond
4713 | 1 | Paid my Dues
4711 | 3 | Cowboys & Kisses
4711 | 2 | I'm Outta Love
| 0 | Alle meine Entchen
(6 Zeilen)
testdb=> SELECT c.id, c.albumtitel, k.gruendungsjahr, c.erscheinungsjahr, l.track, l.titel FROM cd AS c FULL JOIN kuenstler AS k ON c.interpret = k.id FULL JOIN lied AS l ON c.id = l.id;
id | albumtitel | gruendungsjahr | erscheinungsjahr | track | titel
------+--------------------+----------------+------------------+-------+----------------------------
4711 | Not That Kind | 1999 | 2000 | 1 | Not That Kind
4712 | Wish You Were Here | 1965 | 1975 | 1 | Shine On You Crazy Diamond
4713 | Freak of Nature | 1999 | 2001 | 1 | Paid my Dues
4711 | Not That Kind | 1999 | 2000 | 3 | Cowboys & Kisses
4711 | Not That Kind | 1999 | 2000 | 2 | I'm Outta Love
| | | | 0 | Alle meine Entchen
| | 1770 | | |
4714 | leere CD | | 2024 | |
(8 Zeilen)
testdb=>
testdb=> SELECT * from lied, kuenstler, cd;
id | track | titel | id | interpret | gruendungsjahr | id | albumtitel | interpret | erscheinungsjahr
------+-------+----------------------------+-----+------------+----------------+------+--------------------+-----------+------------------
4711 | 1 | Not That Kind | 311 | Anastacia | 1999 | 4712 | Wish You Were Here | 312 | 1975
4711 | 1 | Not That Kind | 312 | Pink Floyd | 1965 | 4712 | Wish You Were Here | 312 | 1975
4711 | 1 | Not That Kind | 314 | Beethoven | 1770 | 4712 | Wish You Were Here | 312 | 1975
4711 | 1 | Not That Kind | 311 | Anastacia | 1999 | 4713 | Freak of Nature | 311 | 2001
4711 | 1 | Not That Kind | 312 | Pink Floyd | 1965 | 4713 | Freak of Nature | 311 | 2001
4711 | 1 | Not That Kind | 314 | Beethoven | 1770 | 4713 | Freak of Nature | 311 | 2001
4711 | 1 | Not That Kind | 311 | Anastacia | 1999 | 4711 | Not That Kind | 311 | 2000
4711 | 1 | Not That Kind | 312 | Pink Floyd | 1965 | 4711 | Not That Kind | 311 | 2000
4711 | 1 | Not That Kind | 314 | Beethoven | 1770 | 4711 | Not That Kind | 311 | 2000
4711 | 1 | Not That Kind | 311 | Anastacia | 1999 | 4714 | leere CD | 313 | 2024
4711 | 1 | Not That Kind | 312 | Pink Floyd | 1965 | 4714 | leere CD | 313 | 2024
4711 | 1 | Not That Kind | 314 | Beethoven | 1770 | 4714 | leere CD | 313 | 2024
4712 | 1 | Shine On You Crazy Diamond | 311 | Anastacia | 1999 | 4712 | Wish You Were Here | 312 | 1975
4712 | 1 | Shine On You Crazy Diamond | 312 | Pink Floyd | 1965 | 4712 | Wish You Were Here | 312 | 1975
4712 | 1 | Shine On You Crazy Diamond | 314 | Beethoven | 1770 | 4712 | Wish You Were Here | 312 | 1975
4712 | 1 | Shine On You Crazy Diamond | 311 | Anastacia | 1999 | 4713 | Freak of Nature | 311 | 2001
4712 | 1 | Shine On You Crazy Diamond | 312 | Pink Floyd | 1965 | 4713 | Freak of Nature | 311 | 2001
4712 | 1 | Shine On You Crazy Diamond | 314 | Beethoven | 1770 | 4713 | Freak of Nature | 311 | 2001
4712 | 1 | Shine On You Crazy Diamond | 311 | Anastacia | 1999 | 4711 | Not That Kind | 311 | 2000
4712 | 1 | Shine On You Crazy Diamond | 312 | Pink Floyd | 1965 | 4711 | Not That Kind | 311 | 2000
4712 | 1 | Shine On You Crazy Diamond | 314 | Beethoven | 1770 | 4711 | Not That Kind | 311 | 2000
4712 | 1 | Shine On You Crazy Diamond | 311 | Anastacia | 1999 | 4714 | leere CD | 313 | 2024
4712 | 1 | Shine On You Crazy Diamond | 312 | Pink Floyd | 1965 | 4714 | leere CD | 313 | 2024
4712 | 1 | Shine On You Crazy Diamond | 314 | Beethoven | 1770 | 4714 | leere CD | 313 | 2024
4713 | 1 | Paid my Dues | 311 | Anastacia | 1999 | 4712 | Wish You Were Here | 312 | 1975
4713 | 1 | Paid my Dues | 312 | Pink Floyd | 1965 | 4712 | Wish You Were Here | 312 | 1975
4713 | 1 | Paid my Dues | 314 | Beethoven | 1770 | 4712 | Wish You Were Here | 312 | 1975
4713 | 1 | Paid my Dues | 311 | Anastacia | 1999 | 4713 | Freak of Nature | 311 | 2001
4713 | 1 | Paid my Dues | 312 | Pink Floyd | 1965 | 4713 | Freak of Nature | 311 | 2001
4713 | 1 | Paid my Dues | 314 | Beethoven | 1770 | 4713 | Freak of Nature | 311 | 2001
4713 | 1 | Paid my Dues | 311 | Anastacia | 1999 | 4711 | Not That Kind | 311 | 2000
4713 | 1 | Paid my Dues | 312 | Pink Floyd | 1965 | 4711 | Not That Kind | 311 | 2000
4713 | 1 | Paid my Dues | 314 | Beethoven | 1770 | 4711 | Not That Kind | 311 | 2000
4713 | 1 | Paid my Dues | 311 | Anastacia | 1999 | 4714 | leere CD | 313 | 2024
4713 | 1 | Paid my Dues | 312 | Pink Floyd | 1965 | 4714 | leere CD | 313 | 2024
4713 | 1 | Paid my Dues | 314 | Beethoven | 1770 | 4714 | leere CD | 313 | 2024
4711 | 3 | Cowboys & Kisses | 311 | Anastacia | 1999 | 4712 | Wish You Were Here | 312 | 1975
4711 | 3 | Cowboys & Kisses | 312 | Pink Floyd | 1965 | 4712 | Wish You Were Here | 312 | 1975
4711 | 3 | Cowboys & Kisses | 314 | Beethoven | 1770 | 4712 | Wish You Were Here | 312 | 1975
4711 | 3 | Cowboys & Kisses | 311 | Anastacia | 1999 | 4713 | Freak of Nature | 311 | 2001
4711 | 3 | Cowboys & Kisses | 312 | Pink Floyd | 1965 | 4713 | Freak of Nature | 311 | 2001
testdb=> SELECT * FROM cd;
id | albumtitel | interpret | erscheinungsjahr
------+--------------------+-----------+------------------
4712 | Wish You Were Here | 312 | 1975
4713 | Freak of Nature | 311 | 2001
4711 | Not That Kind | 311 | 2000
4714 | leere CD | 313 | 2024
(4 Zeilen)
testdb=> SELECT * FROM kuenstler;
id | interpret | gruendungsjahr
-----+------------+----------------
311 | Anastacia | 1999
312 | Pink Floyd | 1965
314 | Beethoven | 1770
(3 Zeilen)
testdb=> SELECT * FROM lied;
id | track | titel
------+-------+----------------------------
4711 | 1 | Not That Kind
4712 | 1 | Shine On You Crazy Diamond
4713 | 1 | Paid my Dues
4711 | 3 | Cowboys & Kisses
4711 | 2 | I'm Outta Love
| 0 | Alle meine Entchen
(6 Zeilen)
testdb=> SELECT * FROM cd, kuenstler;
id | albumtitel | interpret | erscheinungsjahr | id | interpret | gruendungsjahr
------+--------------------+-----------+------------------+-----+------------+----------------
4712 | Wish You Were Here | 312 | 1975 | 311 | Anastacia | 1999
4712 | Wish You Were Here | 312 | 1975 | 312 | Pink Floyd | 1965
4712 | Wish You Were Here | 312 | 1975 | 314 | Beethoven | 1770
4713 | Freak of Nature | 311 | 2001 | 311 | Anastacia | 1999
4713 | Freak of Nature | 311 | 2001 | 312 | Pink Floyd | 1965
4713 | Freak of Nature | 311 | 2001 | 314 | Beethoven | 1770
4711 | Not That Kind | 311 | 2000 | 311 | Anastacia | 1999
4711 | Not That Kind | 311 | 2000 | 312 | Pink Floyd | 1965
4711 | Not That Kind | 311 | 2000 | 314 | Beethoven | 1770
4714 | leere CD | 313 | 2024 | 311 | Anastacia | 1999
4714 | leere CD | 313 | 2024 | 312 | Pink Floyd | 1965
4714 | leere CD | 313 | 2024 | 314 | Beethoven | 1770
(12 Zeilen)
testdb=>
File moved
testdb=> \d
Liste der Relationen
Schema | Name | Typ | Eigentümer
--------+-----------+---------+------------
public | cd | Tabelle | dbsadmin
public | cd_lieder | Sicht | dbsadmin
public | kuenstler | Tabelle | dbsadmin
public | lied | Tabelle | dbsadmin
public | tier | Tabelle | dbsadmin
(5 Zeilen)
testdb=> \d cd_lieder
Sicht »public.cd_lieder«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
------------------+---------+--------------+---------------+-------------
id | integer | | |
albumtitel | text | | |
gruendungsjahr | integer | | |
erscheinungsjahr | integer | | |
track | integer | | |
titel | text | | |
testdb=> \d+ cd_lieder
Sicht »public.cd_lieder«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert | Speicherung | Beschreibung
------------------+---------+--------------+---------------+-------------+-------------+--------------
id | integer | | | | plain |
albumtitel | text | | | | extended |
gruendungsjahr | integer | | | | plain |
erscheinungsjahr | integer | | | | plain |
track | integer | | | | plain |
titel | text | | | | extended |
Sichtdefinition:
SELECT c.id,
c.albumtitel,
k.gruendungsjahr,
c.erscheinungsjahr,
l.track,
l.titel
FROM cd c
JOIN kuenstler k ON c.interpret = k.id
JOIN lied l ON c.id = l.id;
testdb=> \d+ cd
Tabelle »public.cd«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert | Speicherung | Kompression | Statistikziel | Beschreibung
------------------+---------+--------------+---------------+-------------+-------------+-------------+---------------+--------------
id | integer | | not null | | plain | | |
albumtitel | text | | | | extended | | |
interpret | integer | | | | plain | | |
erscheinungsjahr | integer | | | | plain | | |
Indexe:
"cd_pkey" PRIMARY KEY, btree (id)
Fremdschlüsselverweise von:
TABLE "lied" CONSTRAINT "lied_fkey" FOREIGN KEY (id) REFERENCES cd(id) ON DELETE CASCADE
Zugriffsmethode: heap
testdb=> \d+ lied
Tabelle »public.lied«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert | Speicherung | Kompression | Statistikziel | Beschreibung
--------+---------+--------------+---------------+-------------+-------------+-------------+---------------+--------------
id | integer | | | | plain | | |
track | integer | | | | plain | | |
titel | text | | | | extended | | |
Fremdschlüssel-Constraints:
"lied_fkey" FOREIGN KEY (id) REFERENCES cd(id) ON DELETE CASCADE
Zugriffsmethode: heap
testdb=>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment