diff options
Diffstat (limited to 'ws2015')
-rw-r--r-- | ws2015/datenbanksysteme/blaetter/03/abgabe.md | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ws2015/datenbanksysteme/blaetter/03/abgabe.md b/ws2015/datenbanksysteme/blaetter/03/abgabe.md new file mode 100644 index 0000000..df6a9b2 --- /dev/null +++ b/ws2015/datenbanksysteme/blaetter/03/abgabe.md | |||
@@ -0,0 +1,54 @@ | |||
1 | # SQL-DDL | ||
2 | |||
3 | a) | ||
4 | ~~~ {.sql} | ||
5 | CREATE TABLE L | ||
6 | ( lnr VARCHAR(10) PRIMARY KEY | ||
7 | , lname VARCHAR(40) NOT NULL | ||
8 | , sitz VARCHAR(40) | ||
9 | ); | ||
10 | |||
11 | CREATE TABLE T | ||
12 | ( tnr VARCHAR(10) PRIMARY KEY | ||
13 | , tname VARCHAR(40) NOT NULL | ||
14 | , farbe VARCHAR(40) | ||
15 | , gewicht INTEGER | ||
16 | , preis VARCHAR(40) | ||
17 | ); | ||
18 | |||
19 | CREATE TABLE P | ||
20 | ( pnr VARCHAR(10) PRIMARY KEY | ||
21 | , pname VARCHAR(40) NOT NULL | ||
22 | , ort VARCHAR(40) | ||
23 | ); | ||
24 | |||
25 | CREATE TABLE LTP | ||
26 | ( lnr VARCHAR(10) | ||
27 | , tnr VARCHAR(10) | ||
28 | , pnr VARCHAR(10) | ||
29 | , menge INTEGER | ||
30 | , FOREIGN KEY (lnr) REFERENCES L(lnr) | ||
31 | , FOREIGN KEY (tnr) REFERENCES T(tnr) | ||
32 | , FOREIGN KEY (pnr) REFERENCES P(pnr) | ||
33 | , PRIMARY KEY (lnr, tnr, pnr) | ||
34 | ); | ||
35 | ~~~ | ||
36 | b) | ||
37 | ~~~ {.sql} | ||
38 | ALTER TABLE L ADD status INTEGER; | ||
39 | ~~~ | ||
40 | c) | ||
41 | ~~~ {.sql} | ||
42 | ALTER TABLE T MODIFY preis float(2); | ||
43 | ~~~ | ||
44 | d) | ||
45 | ~~~ {.sql} | ||
46 | ALTER TABLE T DROP COLUMN preis; | ||
47 | ~~~ | ||
48 | e) | ||
49 | ~~~ {.sql} | ||
50 | DROP TABLE LTP; | ||
51 | DROP TABLE L; | ||
52 | DROP TABLE T; | ||
53 | DROP TABLE P; | ||
54 | ~~~ | ||