Commit c8563fb0 authored by Daniel Schubert's avatar Daniel Schubert 🎯

15

parent cfb12c0a
......@@ -51,18 +51,7 @@
<section data-transition="slide" data-background="#b5533c" data-background-transition="convex"> <h3>lampp stack</h3> </section>
<section>
<ul>
<li>mysql basics</li>
<li>wordpress tabellen ansehen</li>
<li>apache vhost</li>
<li>letsencrypt</li>
<li></li>
<li></li>
<li></li>
</ul>
</section>
<section>
<pre><code class="bash">~$ sudo apt install apache2 mysql-server phpmyadmin</code></pre>
......@@ -80,6 +69,138 @@ MariaDB [(none)]> \q
</ul>
</section>
<section>
<h3>mysql</h3>
</section>
<section>
mysql ist eine „relationale Datenbank”
<p><cite> Relationale Datenbanken versuchen die Realität in einem Datenmodell abzubilden.</cite>
<ul>
<li>Jede Zeile einer Tabelle ist ein Datensatz</li>
<li>Jede Zeile ( Tupel ) besteht aus Attributen ( die Spalten )</li>
<li>Über Primärschlüssel werden Beziehungen hergestellt</li>
<li>Eine Datenbank kann viele Tabellen beinhalten</li>
</ul>
<img src="img/relationales_datenbankmodell_beispiel.jpg">
<p><small style="font-size:.4em">Quelle: http://www.datenbanken-verstehen.de/datenbank-grundlagen/datenbankmodell/relationales-datenbankmodell/</small>
</section>
<section>
<h4>Normalisierung</h4>
Aufteilung der Attribute (Spalten) in mehrere Relationen ( Tabellen ), so dass eine Form ohne Redundanzen entsteht.
</section>
<section>
<img src="img/Aufspaltung_einer_Tabelle_in_zwei_(Beispiel).svg">
</section>
<section>
<img src="img/Wp_Normal_1_301208_165800.JPG">
</section>
<section>
Verbindung aufnehmen:
<pre><code class="bash">~$ sudo mysql
# oder:
~$ mysql -u BENUTZERNAME -p -h localhost
</code></pre>
<ul>
<li class="fragment ">this</li>
</ul>
</section>
<section>Datenbank erstellen
<pre><code class="sql">CREATE DATABASE IF NOT EXISTS test;
USE test;
CREATE TABLE IF NOT EXISTS books (
BookID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
Title VARCHAR(100) NOT NULL,
SeriesID INT, AuthorID INT);
CREATE TABLE IF NOT EXISTS authors
(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE IF NOT EXISTS series
(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT);
INSERT INTO books (Title,SeriesID,AuthorID)
VALUES('The Fellowship of the Ring',1,1),
('The Two Towers',1,1), ('The Return of the King',1,1),
('The Sum of All Men',2,2), ('Brotherhood of the Wolf',2,2),
('Wizardborn',2,2), ('The Hobbbit',0,1);</code></pre>
</section>
<section>Tabellen anzeigen
<pre><code class="sql">
SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| authors |
| books |
| series |
+----------------+
3 rows in set (0.00 sec)
</code></pre>
</section>
<section>
<pre><code class="sql">DESCRIBE books;
+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| BookID | int(11) | NO | PRI | NULL | auto_increment |
| Title | varchar(100) | NO | | NULL | |
| SeriesID | int(11) | YES | | NULL | |
| AuthorID | int(11) | YES | | NULL | |
+----------+--------------+------+-----+---------+----------------+
</code></pre>
</section>
<section>
Daten anzeigen:
<pre><code class="sql">SELECT * FROM books;
+--------+----------------------------+----------+----------+
| BookID | Title | SeriesID | AuthorID |
+--------+----------------------------+----------+----------+
| 1 | The Fellowship of the Ring | 1 | 1 |
| 2 | The Two Towers | 1 | 1 |
| 3 | The Return of the King | 1 | 1 |
| 4 | The Sum of All Men | 2 | 2 |
| 5 | Brotherhood of the Wolf | 2 | 2 |
| 6 | Wizardborn | 2 | 2 |
| 7 | The Hobbbit | 0 | 1 |
+--------+----------------------------+----------+----------+
7 rows in set (0.00 sec)</code></pre></section>
<section>Daten einfügen:
<pre><code class="sql">INSERT INTO books (Title, SeriesID, AuthorID)
VALUES ("Lair of Bones", 2, 2);
Query OK, 1 row affected (0.00 sec)</code></pre>
<pre><code>SELECT * FROM books;</code></pre></section>
<section>
Daten modifizieren:
<pre><code class="sql">UPDATE books
SET Title = "The Hobbit"
WHERE BookID = 7;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0</code></pre>
</section>
<!--
<section>
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
This diff is collapsed.
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment