🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.delphi.bazy-danych
Article #82557

Re: Wiele do wielu

#82557
From: wloochacz
Date: Mon, 17 Aug 2015 17:23
36 lines
2161 bytes
W dniu 2015-08-16 o 10:30, Borneq pisze:
> Jedna książka może mieć wielu autorów, jeden autor wiele książek. Oprócz
> tabel BOOKS i AUTHORS potrzebna tabela BOOKS_AUTHORS, ale jak to będzie
> wyglądało dla:
> book1 - auth1
> book2 - auth2,auth3
> book3 - auth1,auth3
> book4 - auth1,auth4
> book5 - auth2,auth3,auth4
>
> BOOKS ma 5 pozycji , AUTHORS 4 a BOOKS_AUTHORS?
Tak:

Create Table "Book"  (
	"IdBook" Integer NOT NULL,
  Primary Key ("IdBook")
);

Create Table "Author"  (
	"IdAuthor" Integer NOT NULL,
  Primary Key ("IdAuthor")
);

Create Table "BookAuthor"  (
	"IdBook" Integer NOT NULL,
	"IdAuthor" Integer NOT NULL,
  Primary Key ("IdBook","IdAuthor")
);

Alter Table "BookAuthor" add Foreign Key ("IdBook") references "Book" 
("IdBook") on update no action on delete cascade ;
Alter Table "BookAuthor" add Foreign Key ("IdAuthor") references 
"Author" ("IdAuthor") on update no action on delete cascade ;

-- 
wloochacz
Technical Details
Message-ID: <55d21892$0$4766$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!news.supermedia.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!feeder.erje.net!1.eu.feeder.erje.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!81.171.118.64.MISMATCH!peer04.fr7!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
References: <mqphmf$gio$1@node2.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!news.supermedia.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!feeder.erje.net!1.eu.feeder.erje.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!81.171.118.64.MISMATCH!peer04.fr7!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Subject: Re: Wiele do wielu
Newsgroups: pl.comp.lang.delphi.bazy-danych
References: <mqphmf$gio$1@node2.news.atman.pl>
From: wloochacz <wloochacz@no.spam.gmail.com>
Date: Mon, 17 Aug 2015 19:23:27 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
MIME-Version: 1.0
In-Reply-To: <mqphmf$gio$1@node2.news.atman.pl>
Lines: 36
Message-ID: <55d21892$0$4766$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 83.23.144.64
X-Trace: 1439832210 unt-rea-a-01.news.neostrada.pl 4766 83.23.144.64:2375
X-Complaints-To: abuse@news.neostrada.pl
X-Received-Bytes: 1828
X-Received-Body-CRC: 1060165786
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit