db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Scott" <deni...@gmail.com>
Subject Re: ENUM
Date Fri, 08 Sep 2006 12:52:59 GMT
On the SET datatype: Even the MySQL docs include a section upfront
called "Why you shouldn't use SET"
It's not an atomic datatype. Bad.

On ENUM: The SQL standard way of doing the equivalent of ENUM, and
therefore the Derby way, is to define a check constraint on the

For example, in MySQL you might do something like:

CREATE TABLE nonstandard (
  sizes ENUM('small', 'medium', 'large')

Implementing this as a check constraint in Derby, on the other hand,
would look something like:

CREATE TABLE standard (
  sizes VARCHAR(32) CONSTRAINT sizes_ck CHECK (sizes IN ('small',
'medium', 'large'))

Pretty simple.


On 08/09/06, Chee Cheng <chee.k.cheng@gmail.com> wrote:
> Hi,
> Does Derby offer enumeration type like ENUM and SET?  If not, what's the
> best way to restrict a column to certain pre-defined value?
> Thank you.

View raw message