22marp : true
33title : SQL in the shell
44description : Relationenalgebra auf der Kommandozeile
5- theme : uncover
5+ theme : terminal
66paginate : true
77_paginate : false
8+ class : invert
89---
910
10- ![ bg ] ( ./assets/gradient.jpg )
11+ <!-- _class: lead -->
1112
1213# SQL in the shell
1314
14- Relationenalgebra auf der Kommandozeile
15-
16- <style scoped >a { color : #eee ; }</style >
17-
18- <!-- This is presenter note with. You can write down notes through HTML comment. -->
15+ ### Relationenalgebra auf der Kommandozeile
1916
2017---
2118
22- ![ bg] ( #148 )
23- ![ ] ( #fff )
24-
2519# Relation
2620
2721| id | name | stadt |
@@ -34,9 +28,6 @@ Relationenalgebra auf der Kommandozeile
3428
3529---
3630
37- ![ bg] ( #148 )
38- ![ ] ( #fff )
39-
4031# Operationen
4132
4233- Projektion
@@ -48,9 +39,6 @@ Relationenalgebra auf der Kommandozeile
4839
4940---
5041
51- ![ bg] ( #148 )
52- ![ ] ( #fff )
53-
5442# Projektion
5543
5644> $$
@@ -61,115 +49,99 @@ Relationenalgebra auf der Kommandozeile
6149> \pi_{\beta}(R):=\{t_{\beta}|t \in R\}
6250> $$
6351
64- - ` SELECT CustomerName, City FROM Customers; `
65-
6652---
6753
68- ![ bg] ( #148 )
69- ![ ] ( #fff )
70-
7154# Selektion
7255
7356> $$
7457> \sigma_{\text{A}}(R) := \{ t | t \in R \wedge t \text{ erf\"ullt A} \}
7558> $$
7659
77- - ` SELECT * FROM Customers `
78- ` WHERE Country LIKE '%ada%'; `
60+ ``` sql
61+ SELECT * FROM Customers
62+ WHERE Country LIKE ' %ada%' ;
63+ ```
7964
8065---
8166
82- ![ bg] ( #148 )
83- ![ ] ( #fff )
84-
8567# Vereinigung
8668
8769> $$
8870> R \cup S := \{ t | t \in R \lor t \in S \}
8971> $$
9072
91- - ` SELECT * FROM Customers_A `
92- ` UNION SELECT * FROM Customers_B `
73+ ``` sql
74+ SELECT * FROM Customers_A
75+ UNION
76+ SELECT * FROM Customers_B;
77+ ```
9378
9479---
9580
96- ![ bg] ( #148 )
97- ![ ] ( #fff )
98-
9981# Differenz
10082
10183> $$
102- > R {-} S := R { \setminus} S := \{ t | t \in R \land t \notin S \}
84+ > R \setminus S := \{ t | t \in R \land t \notin S \}
10385> $$
10486
105- - ` SELECT * FROM Customers_A `
106- ` EXCEPT SELECT * FROM Customers_B; `
87+ ``` sql
88+ SELECT * FROM Customers_A
89+ EXCEPT
90+ SELECT * FROM Customers_B;
91+ ```
10792
10893---
10994
110- ![ bg] ( #148 )
111- ![ ] ( #fff )
112-
11395# Umbenennung
11496
11597> $$
11698> \rho_{[\mathrm{neu}\leftarrow\mathrm{alt}]}(R):= \{t'|t'(R-\mathrm{alt})=t(R-\mathrm{alt}) \land t'(\mathrm{neu})=t(\mathrm{alt})\}
11799> $$
118100
119- - ` awk -F ',' '{print $2, $1}' R `
101+ ``` bash
102+ awk -F ' ,' ' {print $2, $1}' R
103+ ```
120104
121105---
122106
123- ![ bg] ( #148 )
124- ![ ] ( #fff )
125-
126107# Kartesisches Produkt
127108
128109> $$
129110> R\times S:=\{(a_1,a_2,...,a_n,b_1,b_2,...,b_m)| \\
130111> (a_1,...,a_n)\in R\wedge (b_1,...,b_m)\in S\}
131112> $$
132113
133- - ` SELECT * FROM R, S; `
114+ ``` sql
115+ SELECT * FROM R, S;
116+ ```
134117
135118---
136119
137- ![ bg] ( #148 )
138- ![ ] ( #fff )
120+ # Join?
139121
140- ## Join?
141-
142- - Selektion
143- - Projektion
144- - Kartesisches Produkt
122+ > Kartesisches Produkt
123+ > Selektion
124+ > Projektion
145125
146126---
147127
148- ![ bg] ( #148 )
149- ![ ] ( #fff )
150-
151128# Revue
152129
153- - [ cat] ( < https://de.wikipedia.org/wiki/Cat_(Unix) > ) : Vereinigung
130+ - [ cat] ( https://de.wikipedia.org/wiki/Cat_(Unix) ) : Vereinigung
154131- [ grep] ( https://de.wikipedia.org/wiki/Grep ) : Selektion
155132- [ awk] ( https://de.wikipedia.org/wiki/Awk ) : Selektion, Projektion, Umbenennung
156133- [ comm] ( https://en.wikipedia.org/wiki/Comm ) : Differenz
157134
158135---
159136
160- ![ bg] ( #148 )
161- ![ ] ( #fff )
137+ # Unix Tools
162138
163- # Et al.
139+ [ cat ] ( https://de.wikipedia.org/wiki/Cat_(Unix) ) · [ sed ] ( https://de.wikipedia.org/wiki/Sed_(Unix) ) · [ grep ] ( https://de.wikipedia.org/wiki/Grep ) · [ cut ] ( https://de.wikipedia.org/wiki/Cut_(Unix) ) · [ awk ] ( https://de.wikipedia.org/wiki/Awk ) · [ join ] ( https://de.wikipedia.org/wiki/Join_(Unix) ) · [ comm ] ( https://en.wikipedia.org/wiki/Comm ) · [ diff ] ( https://de.wikipedia.org/wiki/Diff ) · [ uniq ] ( https://en.wikipedia.org/wiki/Uniq ) · [ sort ] ( https://de.wikipedia.org/wiki/Sort_(Unix) )
164140
165- [ cat] ( < https://de.wikipedia.org/wiki/Cat_(Unix) > ) ,[ sed] ( < https://de.wikipedia.org/wiki/Sed_(Unix) > ) , [ grep] ( https://de.wikipedia.org/wiki/Grep ) , [ cut] ( < https://de.wikipedia.org/wiki/Cut_(Unix) > ) , [ awk] ( https://de.wikipedia.org/wiki/Awk ) , [ join] ( < https://de.wikipedia.org/wiki/Join_(Unix) > ) ,
166- [ comm] ( https://en.wikipedia.org/wiki/Comm ) , [ diff] ( https://de.wikipedia.org/wiki/Diff ) , [ uniq] ( https://en.wikipedia.org/wiki/Uniq ) und [ sort] ( < https://de.wikipedia.org/wiki/Sort_(Unix) > )
141+ > * "Do one thing and do it well"*
167142
168143---
169144
170- ![ bg] ( #148 )
171- ![ ] ( #fff )
172-
173145# Inspiration
174146
175147> * "Relational algebra can turn any
@@ -179,11 +151,12 @@ Relationenalgebra auf der Kommandozeile
179151
180152---
181153
182- ![ bg] ( #148 )
183- ![ ] ( #fff )
154+ <!-- _class: lead -->
155+
156+ ![ w:150] ( https://s.gravatar.com/avatar/b697f623bef1a9d58326f850ec184aa6?s=150 )
184157
185- ![ bg 40% opacity blur ] ( https://s.gravatar.com/avatar/b697f623bef1a9d58326f850ec184aa6?s=80 )
158+ # Danke!
186159
187- # Martin Funk ( [ @eigenfunk ] ( https://github.com/eigenfunk ) )
160+ ** Martin Funk** · [ @eigenfunk ] ( https://github.com/eigenfunk )
188161
189- https://github.com/eigenfunk/sql-in-the-shell
162+ [ github.com/eigenfunk/sql-in-the-shell ] ( https://github.com/eigenfunk/sql-in-the-shell )
0 commit comments