diff --git a/20231116/dbms-13.txt b/20231116/dbms-13.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e740d9c8631e40541aa5598751427a9a03f3524 --- /dev/null +++ b/20231116/dbms-13.txt @@ -0,0 +1,19 @@ +testdb=> INSERT INTO tier SET name = 'Pluto', tierart = 'Hund', id = 31; +FEHLER: Syntaxfehler bei »SET« +ZEILE 1: INSERT INTO tier SET name = 'Pluto', tierart = 'Hund', id = ... + ^ +testdb=> INSERT INTO tier ( id, name, tierart ) VALUES ( 31, 'Pluto', 'Hund' ); +INSERT 0 1 +testdb=> SELECT * FROM tier; name | tierart | id +--------------------------------+--------------------------------+---- + Esmeralda | Spinne | 1 + Timmy | Hund | 2 + Dio | Katze | 3 + Tusnelda | Spinne | 4 + Ragnar | Katze | + Putzi | Ratte | + Micky | Mouse | 30 + Pluto | Hund | 31 +(8 Zeilen) + +testdb=> diff --git a/20231116/dbms-14.txt b/20231116/dbms-14.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a64f6f5e09aa2eb6c37222f4161966551009458 --- /dev/null +++ b/20231116/dbms-14.txt @@ -0,0 +1,26 @@ +testdb=> SELECT * FROM tier; name | tierart | id +--------------------------------+--------------------------------+---- + Esmeralda | Spinne | 1 + Timmy | Hund | 2 + Dio | Katze | 3 + Tusnelda | Spinne | 4 + Ragnar | Katze | + Putzi | Ratte | + Micky | Mouse | 30 + Pluto | Hund | 31 +(8 Zeilen) + +testdb=> DELETE FROM tier WHERE id >= 30; +DELETE 2 +testdb=> SELECT * FROM tier; + name | tierart | id +--------------------------------+--------------------------------+---- + Esmeralda | Spinne | 1 + Timmy | Hund | 2 + Dio | Katze | 3 + Tusnelda | Spinne | 4 + Ragnar | Katze | + Putzi | Ratte | +(6 Zeilen) + +testdb=> diff --git a/20231116/dbms-15.txt b/20231116/dbms-15.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e4ec5a23381e533962b949f1955669a09dfdf07 --- /dev/null +++ b/20231116/dbms-15.txt @@ -0,0 +1,43 @@ +testdb=> SELECT * FROM tier WHERE tierart = 'Katze'; + name | tierart | id +--------------------------------+--------------------------------+---- + Dio | Katze | 3 + Ragnar | Katze | +(2 Zeilen) + +testdb=> SELECT * FROM tier WHERE tierart = '%atze'; + name | tierart | id +------+---------+---- +(0 Zeilen) + +testdb=> SELECT * FROM tier WHERE tierart = '%at%'; + name | tierart | id +------+---------+---- +(0 Zeilen) + +testdb=> SELECT * FROM tier WHERE tierart LIKE '%atze'; + name | tierart | id +------+---------+---- +(0 Zeilen) + +testdb=> SELECT * FROM tier WHERE tierart LIKE '%at%'; + name | tierart | id +--------------------------------+--------------------------------+---- + Dio | Katze | 3 + Ragnar | Katze | + Putzi | Ratte | +(3 Zeilen) + +testdb=> SELECT * FROM tier WHERE tierart LIKE '%%atze'; + name | tierart | id +------+---------+---- +(0 Zeilen) + +testdb=> SELECT * FROM tier WHERE tierart LIKE '%%atze%'; + name | tierart | id +--------------------------------+--------------------------------+---- + Dio | Katze | 3 + Ragnar | Katze | +(2 Zeilen) + +testdb=> diff --git a/20231116/dbms-16.txt b/20231116/dbms-16.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a91a6699fd15104c1900a779a3852a4e81eb90f --- /dev/null +++ b/20231116/dbms-16.txt @@ -0,0 +1,13 @@ +testdb=> SELECT COUNT(*) FROM tier WHERE tierart = 'Katze'; + count +------- + 2 +(1 Zeile) + +testdb=> SELECT COUNT(id) FROM tier WHERE tierart = 'Katze'; + count +------- + 1 +(1 Zeile) + +testdb=> diff --git a/20231116/dbms-17.txt b/20231116/dbms-17.txt new file mode 100644 index 0000000000000000000000000000000000000000..f47738b4dfb396289175c108f566e1b6a2074e35 --- /dev/null +++ b/20231116/dbms-17.txt @@ -0,0 +1,23 @@ +testdb=> SELECT COUNT(*) FROM tier GROUP BY tierart; + count +------- + 2 + 1 + 1 + 2 +(4 Zeilen) + +testdb=> SELECT *, COUNT(*) FROM tier GROUP BY tierart; +FEHLER: Spalte »tier.name« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden +ZEILE 1: SELECT *, COUNT(*) FROM tier GROUP BY tierart; + ^ +testdb=> SELECT tierart, COUNT(*) FROM tier GROUP BY tierart; + tierart | count +--------------------------------+------- + Spinne | 2 + Hund | 1 + Ratte | 1 + Katze | 2 +(4 Zeilen) + +testdb=> diff --git a/20231116/normalformen-01.txt b/20231116/normalformen-01.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f22771f8d9e9afc4976b6822c0b35db0e9613f9 --- /dev/null +++ b/20231116/normalformen-01.txt @@ -0,0 +1,11 @@ +testdb=> CREATE TABLE cd ( cd_id INTEGER, albumtitel TEXT, interpret TEXT, gruendungsjahr INTEGER, erscheinungsjahr INTEGER ); +CREATE TABLE +testdb=> CREATE TABLE lied ( cd_id INTEGER, track integer, titel TEXT ); +CREATE TABLE +testdb=> INSERT INTO TAB + +testdb=> INSERT INTO cd ( cd_id, albumtitel, interpret, gruendungsjahr, erscheinungsjahr ) VALUES ( 4711, 'Not That Kind', 'Anastacia', 1999, 2000 ), ( 4712, 'Wish You Were Here', 'Pink Floyd', 1965, 1975 ), ( 4713, 'Freak of Nature', 'Anastacia', 1999, 2001 ); +INSERT 0 3 +testdb=> INSERT INTO lied ( cd_id, track, titel ) VALUES ( 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' ); +INSERT 0 5 +testdb=>