-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi jerryji,

this database is not normalized.

you may consider switching to:
things(thingid INTEGER, thing_weight etc.)
and
things_translations(thingid INTEGER, thing_name VARCHAR, language CHAR(5))

jerryji wrote:
> Dear Kind Soul,
> 
> I am stuck with the following database referential integrity
> constraint problem.
> 
> I have two tables:
> things(thingid INTEGER, thing_name VARCHAR, language CHAR(5))
> and
> thing_relations(thingid INTEGER, thing_parentid INTEGER)
> 
> things hosts items in different languages, e.g.:
> things(1, 'car', 'en_US'); things(1, 'voiture', 'fr_FR');
> things(2, 'engine', 'en_US'); things(2, 'moteur', 'fr_FR');
> things(3, 'brake', 'en_US'); things(3, 'freins', 'fr_FR');
> 
> while thing_relations describes the "consists of" relationship between
> things, e.g.:
> thing_relations(2, 1);
> thing_relations(3, 1)
> as engine and brake are parts of a car
> 
> but since things(thingid) is not unique hence it can't be the primary
> key in "things" and can't be the foreign key in "thing_relations", how
> can the referential integrity constraints between
> thing_relations(thingid) and things(thingid) be described? Or my
> design is not making sense?
> 
> Many thanks in advance.
> 
> Jerry
> > 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBR2TRNNpwN1sq38njAQLJPgP/diPRHpnH7s/auHx/LTXF5Y2Hx7npdLc/
yLuhvjx6Qatm4eU8sASFLLcTEYv1EZsOMRNVaxBEq7Aq89DeSPGVjIl7iy4egjKv
rKIyCA4W5nhB37vFbdjMpd1fOmLiUqdtm/ObvSBxb6x3Hd3JDXYwcr86ve5j0XtT
hlMT5X2uG4g=
=WTdr
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to