Re: ENUM type

From: Date: Mon, 15 Jan 2001 16:06:27 +0000
Subject: Re: ENUM type
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5881@lists.php.net to get a copy of this message
Greetings, Cahyo! At 15.01.01, 18:47, you wrote: CSA> I don't know what is the benefit if we use ENUM type. CSA> can everybody explain it? It is an ugly crutch. Well, you see, most RDBMSes will allow you to make a 'lookup table' or 'dictionary' or something (dunno its official name). Something like: CREATE TABLE foo_baz_dictionary ( baz integer not null primary key, baz_name char(50) ); -- baz is a potential "enum" field CREATE TABLE foo ( bar integer, ... baz integer, foreign key (baz) references foo_baz_dictionary ); Then when you insert something into 'foo', its 'baz' field is checked against foo_baz_dictionary (which is far more manageable than ENUM field definition). MySQL does not support foreign keys and so its creators came up with ENUM solution. -- Yours, Alexey V. Borzov, Webmaster of RDW

« previous php.db (#5881) next »