diff --git a/15.html b/15.html index dc164d8..3eead4e 100644 --- a/15.html +++ b/15.html @@ -51,18 +51,7 @@

lampp stack

-
- -
- +
~$ sudo apt install apache2 mysql-server phpmyadmin
@@ -80,6 +69,138 @@ MariaDB [(none)]> \q
+ +
+

mysql

+
+ +
+ mysql ist eine „relationale Datenbank” +

Relationale Datenbanken versuchen die Realität in einem Datenmodell abzubilden. +

+ +

Quelle: http://www.datenbanken-verstehen.de/datenbank-grundlagen/datenbankmodell/relationales-datenbankmodell/ +

+ +
+

Normalisierung

+ + Aufteilung der Attribute (Spalten) in mehrere Relationen ( Tabellen ), so dass eine Form ohne Redundanzen entsteht. +
+ +
+ +
+ +
+ +
+ +
+ Verbindung aufnehmen: +
~$ sudo mysql
+# oder:
+~$ mysql -u BENUTZERNAME -p -h localhost
+
+ + + +
+ +
Datenbank erstellen +
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);
+
+ +
Tabellen anzeigen +

+SHOW TABLES;
+
++----------------+
+| Tables_in_test |
++----------------+
+| authors        |
+| books          |
+| series         |
++----------------+
+3 rows in set (0.00 sec)
+					
+
+ + +
+
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    |                |
++----------+--------------+------+-----+---------+----------------+
+					
+
+ +
+ Daten anzeigen: +
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)
+ +
Daten einfügen: +
INSERT INTO books (Title, SeriesID, AuthorID)
+VALUES ("Lair of Bones", 2, 2);
+
+Query OK, 1 row affected (0.00 sec)
+
SELECT * FROM books;
+ +
+ Daten modifizieren: +
UPDATE books 
+SET Title = "The Hobbit" 
+WHERE BookID = 7;
+
+Query OK, 1 row affected (0.00 sec)
+Rows matched: 1  Changed: 1  Warnings: 0
+
+ + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + TBL_AdressenAllesFirmaStrassePLZOrt + + + + + TBL_PLZOrtPLZOrt + + + + + + TBL_AdressenAdressIDFirmaStrassePLZ + + + + diff --git a/img/Wp_Normal_1_301208_165800.JPG b/img/Wp_Normal_1_301208_165800.JPG new file mode 100644 index 0000000..1d59e65 Binary files /dev/null and b/img/Wp_Normal_1_301208_165800.JPG differ diff --git a/img/relationales_datenbankmodell_beispiel.jpg b/img/relationales_datenbankmodell_beispiel.jpg new file mode 100644 index 0000000..59e0267 Binary files /dev/null and b/img/relationales_datenbankmodell_beispiel.jpg differ diff --git a/lib/font/league-gothic/league-gothic.eot b/lib/font/league-gothic/league-gothic.eot old mode 100755 new mode 100644 diff --git a/lib/font/league-gothic/league-gothic.ttf b/lib/font/league-gothic/league-gothic.ttf old mode 100755 new mode 100644 diff --git a/lib/font/league-gothic/league-gothic.woff b/lib/font/league-gothic/league-gothic.woff old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-italic.eot b/lib/font/source-sans-pro/source-sans-pro-italic.eot old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-italic.ttf b/lib/font/source-sans-pro/source-sans-pro-italic.ttf old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-italic.woff b/lib/font/source-sans-pro/source-sans-pro-italic.woff old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-regular.eot b/lib/font/source-sans-pro/source-sans-pro-regular.eot old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-regular.ttf b/lib/font/source-sans-pro/source-sans-pro-regular.ttf old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-regular.woff b/lib/font/source-sans-pro/source-sans-pro-regular.woff old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-semibold.eot b/lib/font/source-sans-pro/source-sans-pro-semibold.eot old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-semibold.ttf b/lib/font/source-sans-pro/source-sans-pro-semibold.ttf old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-semibold.woff b/lib/font/source-sans-pro/source-sans-pro-semibold.woff old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot b/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf b/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf old mode 100755 new mode 100644 diff --git a/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff b/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff old mode 100755 new mode 100644 diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js old mode 100755 new mode 100644 diff --git a/plugin/math/math.js b/plugin/math/math.js old mode 100755 new mode 100644