Article View: pl.comp.lang.delphi.bazy-danych
Article #82552Re: Firebird, klucz główny i obcy
From: arivald
Date: Sun, 16 Aug 2015 09:30
Date: Sun, 16 Aug 2015 09:30
26 lines
1769 bytes
1769 bytes
On 2015-08-16 09:49, Borneq wrote: > Zaczynam pracę z bazami danych Firebirda. Jak na razie mam problem, bo > pole typu VARCHAR nie może być kluczem głównym, np. ISBN książki. > Mam pytania: jak zrobić klucz główny składający się z kilku kolumn w > IBExpercie? To znaczy jedna i druga kolumna może się powtarzać, ale ich > konkatenacja nie, jest unikalna i może być kluczem głównym. > A co z foreign key? Gdy mamy relację one-to-many to po której stronie > (one czy many?) tworzymy foreign key? Jako constraint, albo bezpośrednio w definicji tabeli, albo dodany później (alter table). create table people ( id int not null, nickname varchar(12) not null, country char(4), .. .. constraint pkey primary key (id, nickname), ) W zasadzie we wszystkich SQLach jest tak samo, podajesz więcej niż jedną kolumnę, czy to PKey, czy FKey -- Arivald
Technical Details
Message-ID:
<mqpl7f$kqu$1@speranza.aioe.org>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!newsreader4.netcologne.de!news.netcologne.de!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!.POSTED!not-for-mailReferences:
<mqpf9j$e91$1@node2.news.atman.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!newsreader4.netcologne.de!news.netcologne.de!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: arivald <arivald@nowhere.interia.pl> Newsgroups: pl.comp.lang.delphi.bazy-danych Subject: Re: Firebird, klucz główny i obcy Date: Sun, 16 Aug 2015 11:30:24 +0200 Organization: Aioe.org NNTP Server Lines: 27 Message-ID: <mqpl7f$kqu$1@speranza.aioe.org> References: <mqpf9j$e91$1@node2.news.atman.pl> NNTP-Posting-Host: p5v9bseEnRCO7pYKeT3k3A.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Thunderbird/40.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit