diff options
Diffstat (limited to 'ws2015/dbs')
-rw-r--r-- | ws2015/dbs/blaetter/08/abgabe.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ws2015/dbs/blaetter/08/abgabe.md b/ws2015/dbs/blaetter/08/abgabe.md new file mode 100644 index 0000000..634a07e --- /dev/null +++ b/ws2015/dbs/blaetter/08/abgabe.md | |||
@@ -0,0 +1,30 @@ | |||
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 L.lnr, L.lname, COUNT(LTP.pnr) FROM L, LTP WHERE L.lnr = LTP.lnr GROUP BY LTP.pnr | ||
12 | ~~~ | ||
13 | |||
14 | b) | ||
15 | |||
16 | ~~~ {.sql} | ||
17 | SELECT LTP.pnr, SUM(LTP.menge) FROM LTP GROUP BY LTP.pnr | ||
18 | ~~~ | ||
19 | |||
20 | c) | ||
21 | |||
22 | ~~~ {.sql} | ||
23 | SELECT L.lnr, L.lname, COUNT(LTP.pnr) FROM L, LTP WHERE L.lnr = LTP.lnr, COUNT(LTP.pnr) > 2 GROUP BY LTP.pnr | ||
24 | ~~~ | ||
25 | |||
26 | d) | ||
27 | |||
28 | ~~~ {.sql} | ||
29 | SELECT L.lnr, L.lname, L.lsitz, T.tname, LTP.menge * L.gewicht / LTPSS.aggr * 100 FROM L, T, LTP JOIN (SELECT SUM(LTPS.menge) * TS.gewicht as aggr FROM LTP as LTPS, T as TS WHERE LTP.tnr = LTPS.tnr AND TS.tnr = LTPS.tnr GROUP BY LTPS.tnr) as LTPSS USING LTP.tnr WHERE L.lnr = LTP.lnr AND T.tnr = LTP.tnr GROUP BY LTP.tnr | ||
30 | ~~~ | ||