Обсуждение: How to set a constraint on non-unique fields?

Поиск
Список
Период
Сортировка

How to set a constraint on non-unique fields?

От
Michael Monnerie
Дата:
Hi list, I hope this is not OT here, but I'm no SQL guru and sure some
know this. I have two tables:

(just in short format)
multilang (id int, language int, text text);
types (id int, textid references multilang(id) on delete restrict);

But that doesn't work out, because "id" in multilang is not unique. For
one "id", there can be several "language" values, having a text in that
language. Now in table types, I want to make sure that "textid" MUST
exist in multilang, and cannot be deleted when having references. How
would I do that?

mfg zmi
--
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0676/846 914 666                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: EA39 8918 EDFF 0A68 ACFB  11B7 BA2D 060F 1C6F E6B0
// Keyserver: www.keyserver.net                   Key-ID: 1C6FE6B0

Вложения