Relationale Datenbanken (BD 2015): Unterschied zwischen den Versionen
Aus Philo Wiki
Anna (Diskussion | Beiträge) K (first) |
Anna (Diskussion | Beiträge) K (sql) |
||
Zeile 1: | Zeile 1: | ||
<br /> | <br /> | ||
+ | C.J. Date: Introduction to Database Systems (Edition 6). 1094 | ||
+ | |||
+ | <p align="center"> | ||
[[Bild:Date.png|800px]] | [[Bild:Date.png|800px]] | ||
+ | </p> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | ---- | ||
+ | |||
+ | === Beispieldatenbank t50 === | ||
+ | |||
+ | <p align="center"> | ||
+ | [[Bild:t50-er.png|800px]] | ||
+ | </p> | ||
+ | |||
+ | <pre> | ||
+ | CREATE TABLE `personen` ( | ||
+ | `pers_id` smallint(6) NOT NULL, | ||
+ | `vornamen` char(15) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | `nachname` char(25) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | `plz` char(10) COLLATE utf8_unicode_ci DEFAULT NULL, | ||
+ | `ort` char(30) COLLATE utf8_unicode_ci DEFAULT NULL, | ||
+ | `strasze` char(35) COLLATE utf8_unicode_ci DEFAULT NULL, | ||
+ | `nummer` smallint(6) NOT NULL, | ||
+ | `telefon` int(11) NOT NULL, | ||
+ | `email` char(60) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | `homepage` char(100) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | PRIMARY KEY (`pers_id`); | ||
+ | |||
+ | |||
+ | CREATE TABLE `objekte` ( | ||
+ | `objekt_id` char(10) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | `titel` char(30) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | `technik` char(35) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | `format` char(30) COLLATE utf8_unicode_ci DEFAULT NULL, | ||
+ | `jahr` smallint(6) NOT NULL, | ||
+ | `notiz` char(25) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | `auflage` smallint(6) NOT NULL, | ||
+ | PRIMARY KEY (`objekt_id`); | ||
+ | |||
+ | |||
+ | CREATE TABLE `artists` ( | ||
+ | `pers_id` smallint(6) NOT NULL, | ||
+ | `objekt_id` char(10) COLLATE utf8_unicode_ci NOT NULL, | ||
+ | PRIMARY KEY (`pers_id`,`objekt_id`), | ||
+ | KEY `objekt_id` (`objekt_id`), | ||
+ | KEY `pers_id` (`pers_id`); | ||
+ | |||
+ | insert into objekte | ||
+ | values ('1', 'Traumata','Zeichnung','30cm x 50cm','2014','','1'); | ||
+ | |||
+ | insert into artists values ('4','2') | ||
+ | |||
+ | SELECT * | ||
+ | FROM personen p, artists a | ||
+ | WHERE p.pers_id = a.pers_id | ||
+ | |||
+ | |||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
---- | ---- | ||
[[Category:Big Data. WS 2015]] | [[Category:Big Data. WS 2015]] |
Version vom 11. November 2015, 17:12 Uhr
C.J. Date: Introduction to Database Systems (Edition 6). 1094
Beispieldatenbank t50
CREATE TABLE `personen` ( `pers_id` smallint(6) NOT NULL, `vornamen` char(15) COLLATE utf8_unicode_ci NOT NULL, `nachname` char(25) COLLATE utf8_unicode_ci NOT NULL, `plz` char(10) COLLATE utf8_unicode_ci DEFAULT NULL, `ort` char(30) COLLATE utf8_unicode_ci DEFAULT NULL, `strasze` char(35) COLLATE utf8_unicode_ci DEFAULT NULL, `nummer` smallint(6) NOT NULL, `telefon` int(11) NOT NULL, `email` char(60) COLLATE utf8_unicode_ci NOT NULL, `homepage` char(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`pers_id`); CREATE TABLE `objekte` ( `objekt_id` char(10) COLLATE utf8_unicode_ci NOT NULL, `titel` char(30) COLLATE utf8_unicode_ci NOT NULL, `technik` char(35) COLLATE utf8_unicode_ci NOT NULL, `format` char(30) COLLATE utf8_unicode_ci DEFAULT NULL, `jahr` smallint(6) NOT NULL, `notiz` char(25) COLLATE utf8_unicode_ci NOT NULL, `auflage` smallint(6) NOT NULL, PRIMARY KEY (`objekt_id`); CREATE TABLE `artists` ( `pers_id` smallint(6) NOT NULL, `objekt_id` char(10) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`pers_id`,`objekt_id`), KEY `objekt_id` (`objekt_id`), KEY `pers_id` (`pers_id`); insert into objekte values ('1', 'Traumata','Zeichnung','30cm x 50cm','2014','','1'); insert into artists values ('4','2') SELECT * FROM personen p, artists a WHERE p.pers_id = a.pers_id