summaryrefslogtreecommitdiffstats
path: root/Bachelor/Datenbanken 2/Praktikum3/bibcreatemysql.sql
blob: 73f11f5afb74ede0160e19327430801f8d8f68ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*==============================================================*/
/* Database name:  CONCEPTUALDATAMODEL_1                        */
/* DBMS name:      MySQL 3.23 - noch ohne FK-Constraints!       */
/* Created on:     23.04.2006 20:43:53                          */
/*==============================================================*/


drop index RELATIONSHIP_4_FK on AUSLEIHE;

drop index RELATIONSHIP_5_FK on AUSLEIHE;

drop index AUTOR_BUCH2_FK on AUTOR_BUCH;

drop index AUTOR_BUCH_FK on AUTOR_BUCH;

drop table if exists AUDIO;

drop table if exists AUSLEIHE;

drop table if exists AUTOR;

drop table if exists AUTOR_BUCH;

drop table if exists BUCH;

drop table if exists ENTLEIHER;

drop table if exists LEIHOBJEKT;

drop table if exists ZEITSCHRIFT;

/*==============================================================*/
/* Table: AUDIO                                                 */
/*==============================================================*/
create table if not exists AUDIO
(
   LEIHNR                         char(10)                       not null,
   KATEGORIE                      char(2),
   ATITEL                         varchar(30),
   primary key (LEIHNR)
);

/*==============================================================*/
/* Table: AUSLEIHE                                              */
/*==============================================================*/
create table if not exists AUSLEIHE
(
   LEIHNR                         char(10)                       not null,
   ENR                            char(10)                       not null,
   DATUM                          date                           not null,
   BACKDATE                       date,
   OVER                           int,
   primary key (LEIHNR, ENR, DATUM)
);

/*==============================================================*/
/* Index: RELATIONSHIP_4_FK                                     */
/*==============================================================*/
create index RELATIONSHIP_4_FK on AUSLEIHE
(
   LEIHNR
);

/*==============================================================*/
/* Index: RELATIONSHIP_5_FK                                     */
/*==============================================================*/
create index RELATIONSHIP_5_FK on AUSLEIHE
(
   ENR
);

/*==============================================================*/
/* Table: AUTOR                                                 */
/*==============================================================*/
create table if not exists AUTOR
(
   ACODE                          char(7)                        not null,
   ANAME                          varchar(20),
   primary key (ACODE)
);

/*==============================================================*/
/* Table: AUTOR_BUCH                                            */
/*==============================================================*/
create table if not exists AUTOR_BUCH
(
   LEIHNR                         char(10)                       not null,
   ACODE                          char(7)                        not null,
   primary key (LEIHNR, ACODE)
);

/*==============================================================*/
/* Index: AUTOR_BUCH_FK                                         */
/*==============================================================*/
create index AUTOR_BUCH_FK on AUTOR_BUCH
(
   LEIHNR
);

/*==============================================================*/
/* Index: AUTOR_BUCH2_FK                                        */
/*==============================================================*/
create index AUTOR_BUCH2_FK on AUTOR_BUCH
(
   ACODE
);

/*==============================================================*/
/* Table: BUCH                                                  */
/*==============================================================*/
create table if not exists BUCH
(
   LEIHNR                         char(10)                       not null,
   ISBN                           char(15),
   BTITEL                         varchar(30),
   ERSCHJAHR                      int,
   primary key (LEIHNR)
);

/*==============================================================*/
/* Table: ENTLEIHER                                             */
/*==============================================================*/
create table if not exists ENTLEIHER
(
   ENR                            char(10)                       not null,
   ENAME                          varchar(20),
   primary key (ENR)
);

/*==============================================================*/
/* Table: LEIHOBJEKT                                            */
/*==============================================================*/
create table if not exists LEIHOBJEKT
(
   LEIHNR                         char(10)                       not null,
   LEIHTYP                        char(1)                        not null,
   primary key (LEIHNR)
);

/*==============================================================*/
/* Table: ZEITSCHRIFT                                           */
/*==============================================================*/
create table if not exists ZEITSCHRIFT
(
   LEIHNR                         char(10)                       not null,
   JAHRGANG                       int,
   ZTITEL                         varchar(30),
   primary key (LEIHNR)
);