diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-12-02 20:15:30 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-12-02 20:15:30 +0000 |
commit | 96fb44531cc9d0b3f2a0fa1b0e0d5dae1ec8806c (patch) | |
tree | b5b68c9e3c115733f661fa0005ee0007940f1a99 /ws2015/dbs | |
parent | a3e67b7fd44141042413ba29500cc8fd6c7aa3fb (diff) | |
download | uni-96fb44531cc9d0b3f2a0fa1b0e0d5dae1ec8806c.tar uni-96fb44531cc9d0b3f2a0fa1b0e0d5dae1ec8806c.tar.gz uni-96fb44531cc9d0b3f2a0fa1b0e0d5dae1ec8806c.tar.bz2 uni-96fb44531cc9d0b3f2a0fa1b0e0d5dae1ec8806c.tar.xz uni-96fb44531cc9d0b3f2a0fa1b0e0d5dae1ec8806c.zip |
dbs - 07
Diffstat (limited to 'ws2015/dbs')
-rw-r--r-- | ws2015/dbs/blaetter/07/abgabe.md | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ws2015/dbs/blaetter/07/abgabe.md b/ws2015/dbs/blaetter/07/abgabe.md new file mode 100644 index 0000000..1b5297a --- /dev/null +++ b/ws2015/dbs/blaetter/07/abgabe.md | |||
@@ -0,0 +1,44 @@ | |||
1 | --- | ||
2 | header-includes: | ||
3 | - \lstset{frame=single, breaklines=true, postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}}} | ||
4 | --- | ||
5 | |||
6 | # Anfragen in SQL | ||
7 | |||
8 | a) | ||
9 | |||
10 | ~~~ {.sql} | ||
11 | SELECT pname FROM P WHERE ort IN (SELECT sitz FROM L WHERE lname = "Müller" OR lname = "Schmidt" ) | ||
12 | ~~~ | ||
13 | |||
14 | b) | ||
15 | |||
16 | ~~~ {.sql} | ||
17 | SELECT pname FROM P WHERE pnr IN (SELECT LTP.pnr FROM LTP, T WHERE T.tnr = LTP.tnr AND T.gewicht > 10) | ||
18 | ~~~ | ||
19 | |||
20 | c) | ||
21 | |||
22 | ~~~ {.sql} | ||
23 | SELECT lname, status, sitz FROM L ORDER BY status, sitz DESC | ||
24 | ~~~ | ||
25 | |||
26 | d) | ||
27 | |||
28 | ~~~ {.sql} | ||
29 | SELECT tname, farbe, gewicht FROM T WHERE gewicht >= (SELECT MAX(gewicht) FROM T) | ||
30 | ~~~ | ||
31 | |||
32 | e) | ||
33 | |||
34 | ~~~ {.sql} | ||
35 | SELECT P.pname FROM P, LTP LEFT JOIN ( SELECT lnr, COUNT(*) ls FROM L WHERE status <= 30 ) L ON LTP.lnr = L.lnr WHERE LTP.pnr = P.pnr AND L.ls <= 2 | ||
36 | ~~~ | ||
37 | |||
38 | # Anfragen in SQL | ||
39 | |||
40 | a) | ||
41 | |||
42 | ~~~ {.sql} | ||
43 | SELECT L.lname FROM L WHERE (SELECT COUNT(*) FROM LTP, P WHERE p.ort = "Berlin" AND LTP.lnr = L.lnr GROUP BY P.pnr) >= (SELECT COUNT(*) FROM P WHERE P.ort = "Berlin") | ||
44 | ~~~ | ||