Witam!
Mam problem...
muszę zrobić pewien projekt, a moja wiedza na temat baz danych jest... no cóż... żadna, ogranicza się tylko do kilku komend.
Baza ma zawierać różnego typu publikacje (artykuły, książki, materiały konferencyjne, prace magisterskie, doktorskie itp. w sumie 12 rodzajów publikacji) i nie bardzo wiem jak się do tego zabrać, niby sprawa prosta: publikacja może mieć wielu autorów, a autor może napisać kilka publikaji czyli relacja wiele do wielu, jednak dla takiego laika jak ja nie jest to takie proste.
Stworzyłem schemat, skrypt tworzący bazę, jednak nie jest to zrobione tak jak powinno. Prosiłbym, aby ktoś fachowym okiem rzucił na ten skrypt i podpowiedział mi ewentualnie jakie zmiany mam wprowadzić, aby było dobrze.
Skrypt zamieszczam poniżej.
Dodam jeszcze, że bazę muszę stworzyć w PosrgreSQL (aktualnie posiadam werjse 8.3 i pracuje na Viście).
create table author (id int NOT NULL ,
imię VARCHAR(30) NOT NULL,
nazwisko VARCHAR(40) NOT NULL,
PRIMARY KEY (id));
create table article (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
jurnal varchar(100) NOT NULL,
year int NOT NULL,
volume int,
number int,
PRIMARY KEY (id));
create table author_to_article (author_id int NOT NULL,
article_id int NOT NULL);
create table book (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
publisher varchar(200) NOT NULL,
year int NOT NULL,
volume int,
series varchar(30),
adress varchar(50),
editor varchar(50),
month varchar (12),
note varchar (50),
PRIMARY KEY (id));
create table author_to_book (author_id int NOT NULL,
book_id int NOT NULL);
create table inproceedings (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
booktitle varchar(200) NOT NULL,
year int NOT NULL,
volume int,
series varchar(30),
adress varchar(50),
pages int,
publisher varchar(200),
organization varchar(50),
chapter varchar(50),
editor varchar(50),
month varchar (12),
note varchar (50),
PRIMARY KEY (id));
create table author_to_inproceedings (author_id int NOT NULL,
inproceedings_id int NOT NULL);
create table booklet (id int NOT NULL,
title varchar(200) NOT NULL,
howpublished varchar(200) NOT NULL,
adress varchar(50),
year int,
month varchar (12),
note varchar (50),
PRIMARY KEY (id));
create table inbook (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
chapter varchar(50) NOT NULL,
publisher varchar(200) NOT NULL,
year int NOT NULL,
volume int,
series varchar(30),
adress varchar(50),
type varchar(50),
edition int,
month varchar (12),
note varchar (50),
PRIMARY KEY (id));
create table author_to_inbook (author_id int NOT NULL,
inbook_id int NOT NULL);
create table incollection (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
booktitle varchar(200) NOT NULL,
publisher varchar(200) NOT NULL,
year int NOT NULL,
editor varchar(50),
volume int,
series int,
type varchar(50),
chapter varchar(50),
pages int,
adress varchar(50),
edition int,
month varchar (12),
note varchar(50),
PRIMARY KEY (id));
create table author_to_incollection (author_id int NOT NULL,
incollection_id int NOT NULL);
create table manual (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
organization varchar(50),
adress varchar(50),
edition int,
month varchar (12),
year int,
note varchar(50),
PRIMARY KEY (id));
create table author_to_manual (author_id int NOT NULL,
manual_id int NOT NULL);
create table masterhesis (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
school varchar(50) NOT NULL,
year int NOT NULL,
type varchar(50),
adress varchar(50),
month varchar(12),
note varchar(50),
PRIMARY KEY (id));
create table author_to_masterhesis (author_id int NOT NULL,
masterhesis_id int NOT NULL);
create table phdthesis (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
school varchar(50) NOT NULL,
year int NOT NULL,
type varchar(50),
adress varchar(50),
month varchar(12),
note varchar(50),
PRIMARY KEY (id));
create table author_to_phdthesis (author_id int NOT NULL,
phdthesis_id int NOT NULL);
create table techreport (id int NOT NULL,
author_id int NOT NULL,
title varchar(200) NOT NULL,
institution varchar(50) NOT NULL,
year int NOT NULL,
editor varchar(50),
volume int,
series varchar(30),
adress varchar(50),
publisher varchar(200),
organization varchar(50),
month varchar (12),
note char (50),
PRIMARY KEY (id));
create table author_to_techreport (author_id int NOT NULL,
techreport_id int NOT NULL);
create table misc (id int NOT NULL,
author_id int NOT NULL,
title varchar(200),
howpublished varchar(200),
month varchar(12),
year int,
note varchar(50),
PRIMARY KEY (id));
create table author_to_misc (author_id int NOT NULL,
misc_id int NOT NULL);