Hi Leute!!
hab mal wieder Fragen und zwar vorerst nur zwei.. grins
Warum kann er die Tabelle tbl_telefon nicht erstellen??? Ist vermutlich ein Flüchtigkeitsfehler.. aber ich finde ihn nicht!!
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'usage
varchar(15),
type varchar(10),
description varchar(255),
PRIMARY KEY(id' at line 6
.. und warum auch nicht die Verbindungsttabellen??
ERROR 1005 (HY000): Can't create table 'bibliothek.tbl_person_tel' (errno: 150)
ERROR 1005 (HY000): Can't create table 'bibliothek.tbl_publisher_person' (errno:
150)
ERROR 1005 (HY000): Can't create table 'bibliothek.tbl_actor_person' (errno: 150
)
ERROR 1005 (HY000): Can't create table 'bibliothek.tbl_director_person' (errno:
150)
laut Errorcode soll der Fremdschlüssel falsch sein. Habe ihn aber genauso wie im Handbuch beschrieben gesetzt.
MySQL :: MySQL 5.0 Reference Manual :: 13.2.4.4 FOREIGN KEY Constraints
Achja für Verbesserungsvorschläge an der DB bin ich immer offen (z.B. betreffend der Wiederholungen in den Tabellen für Bücher, CDs und Filme)
Das ist meine DB (noch nicht vollständig da Tabellen bisher nur auf tbl_movie bezogen):
[sql]
create table tbl_movie(
id int unsigned not null auto_increment,
title varchar(30),
description blob,
publication year(4),
cover varchar(255),
genre_id int not null default 1,
language_id int not null default 1,
subtitle_id int,
publisher_id int,
actor_id int,
director_id int,
borrow boolean,
location_id int,
PRIMARY KEY(id)
)engine=innodb;
create table tbl_book(
id int unsigned not null auto_increment,
title varchar(30),
description blob,
publication year(4),
cover varchar(255),
genre_id int not null default 1,
language_id int not null default 1,
publisher_id int,
author_id int,
isbn10 varchar(10),
isbn13 varchar(13),
borrow boolean,
location_id int,
PRIMARY KEY(id)
)engine=innodb;
create table tbl_cd(
id int unsigned not null auto_increment,
title varchar(30),
description blob,
publication year(4),
cover varchar(255),
genre_id int not null default 1,
language_id int not null default 1,
publisher_id int,
interpret_id int,
borrow boolean,
location_id int,
PRIMARY KEY(id)
)engine=innodb;
create table tbl_person(
id int unsigned not null auto_increment,
given_name varchar(30),
surname varchar(30),
street varchar(50),
city varchar(50),
country varchar(50),
telefon_id int,
email varchar(50),
homepage varchar(50),
PRIMARY KEY(id)
)engine=innodb;
create table tbl_telefon(
id int unsigned not null auto_increment,
int_area_code varchar(5),
prefix varchar(10),
callnumber varchar(15),
usage varchar(15),
type varchar(10),
description varchar(255),
PRIMARY KEY(id)
)engine=innodb;
create table tbl_language(
id int unsigned not null auto_increment,
language varchar(30),
PRIMARY KEY(id)
)engine=innodb;
create table tbl_genre(
id int unsigned not null auto_increment,
genre varchar(15),
PRIMARY KEY(id)
)engine=innodb;
#m:n Beziehungen#
create table tbl_person_tel(
person_id int not null,
tel_id int not null,
INDEX(person_id),
FOREIGN KEY(person_id) REFERENCES tbl_person(id),
INDEX(tel_id),
FOREIGN KEY(tel_id) REFERENCES tbl_telefon(id)
)engine=innodb;
create table tbl_publisher_person(
publisher_id int not null,
person_id int not null,
INDEX(publisher_id),
FOREIGN KEY(publisher_id) REFERENCES tbl_movie(publisher_id),
INDEX(person_id),
FOREIGN KEY(person_id) REFERENCES tbl_person(id)
)engine=innodb;
create table tbl_actor_person(
actor_id int not null,
person_id int not null,
INDEX(actor_id),
FOREIGN KEY(actor_id) REFERENCES tbl_movie(actor_id),
INDEX(person_id),
FOREIGN KEY(person_id) REFERENCES tbl_person(id)
)engine=innodb;
create table tbl_director_person(
director_id int not null,
person_id int not null,
INDEX(director_id),
FOREIGN KEY(director_id) REFERENCES tbl_movie(director_id),
INDEX(person_id),
FOREIGN KEY(person_id) REFERENCES tbl_person(id)
)engine=innodb;
[/sql]
hab mal wieder Fragen und zwar vorerst nur zwei.. grins
Warum kann er die Tabelle tbl_telefon nicht erstellen??? Ist vermutlich ein Flüchtigkeitsfehler.. aber ich finde ihn nicht!!
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'usage
varchar(15),
type varchar(10),
description varchar(255),
PRIMARY KEY(id' at line 6
.. und warum auch nicht die Verbindungsttabellen??
ERROR 1005 (HY000): Can't create table 'bibliothek.tbl_person_tel' (errno: 150)
ERROR 1005 (HY000): Can't create table 'bibliothek.tbl_publisher_person' (errno:
150)
ERROR 1005 (HY000): Can't create table 'bibliothek.tbl_actor_person' (errno: 150
)
ERROR 1005 (HY000): Can't create table 'bibliothek.tbl_director_person' (errno:
150)
laut Errorcode soll der Fremdschlüssel falsch sein. Habe ihn aber genauso wie im Handbuch beschrieben gesetzt.
MySQL :: MySQL 5.0 Reference Manual :: 13.2.4.4 FOREIGN KEY Constraints
Achja für Verbesserungsvorschläge an der DB bin ich immer offen (z.B. betreffend der Wiederholungen in den Tabellen für Bücher, CDs und Filme)
Das ist meine DB (noch nicht vollständig da Tabellen bisher nur auf tbl_movie bezogen):
[sql]
create table tbl_movie(
id int unsigned not null auto_increment,
title varchar(30),
description blob,
publication year(4),
cover varchar(255),
genre_id int not null default 1,
language_id int not null default 1,
subtitle_id int,
publisher_id int,
actor_id int,
director_id int,
borrow boolean,
location_id int,
PRIMARY KEY(id)
)engine=innodb;
create table tbl_book(
id int unsigned not null auto_increment,
title varchar(30),
description blob,
publication year(4),
cover varchar(255),
genre_id int not null default 1,
language_id int not null default 1,
publisher_id int,
author_id int,
isbn10 varchar(10),
isbn13 varchar(13),
borrow boolean,
location_id int,
PRIMARY KEY(id)
)engine=innodb;
create table tbl_cd(
id int unsigned not null auto_increment,
title varchar(30),
description blob,
publication year(4),
cover varchar(255),
genre_id int not null default 1,
language_id int not null default 1,
publisher_id int,
interpret_id int,
borrow boolean,
location_id int,
PRIMARY KEY(id)
)engine=innodb;
create table tbl_person(
id int unsigned not null auto_increment,
given_name varchar(30),
surname varchar(30),
street varchar(50),
city varchar(50),
country varchar(50),
telefon_id int,
email varchar(50),
homepage varchar(50),
PRIMARY KEY(id)
)engine=innodb;
create table tbl_telefon(
id int unsigned not null auto_increment,
int_area_code varchar(5),
prefix varchar(10),
callnumber varchar(15),
usage varchar(15),
type varchar(10),
description varchar(255),
PRIMARY KEY(id)
)engine=innodb;
create table tbl_language(
id int unsigned not null auto_increment,
language varchar(30),
PRIMARY KEY(id)
)engine=innodb;
create table tbl_genre(
id int unsigned not null auto_increment,
genre varchar(15),
PRIMARY KEY(id)
)engine=innodb;
#m:n Beziehungen#
create table tbl_person_tel(
person_id int not null,
tel_id int not null,
INDEX(person_id),
FOREIGN KEY(person_id) REFERENCES tbl_person(id),
INDEX(tel_id),
FOREIGN KEY(tel_id) REFERENCES tbl_telefon(id)
)engine=innodb;
create table tbl_publisher_person(
publisher_id int not null,
person_id int not null,
INDEX(publisher_id),
FOREIGN KEY(publisher_id) REFERENCES tbl_movie(publisher_id),
INDEX(person_id),
FOREIGN KEY(person_id) REFERENCES tbl_person(id)
)engine=innodb;
create table tbl_actor_person(
actor_id int not null,
person_id int not null,
INDEX(actor_id),
FOREIGN KEY(actor_id) REFERENCES tbl_movie(actor_id),
INDEX(person_id),
FOREIGN KEY(person_id) REFERENCES tbl_person(id)
)engine=innodb;
create table tbl_director_person(
director_id int not null,
person_id int not null,
INDEX(director_id),
FOREIGN KEY(director_id) REFERENCES tbl_movie(director_id),
INDEX(person_id),
FOREIGN KEY(person_id) REFERENCES tbl_person(id)
)engine=innodb;
[/sql]
Zuletzt bearbeitet von einem Moderator: