Re: ENUM type

From: Date: Mon, 15 Jan 2001 15:27:53 +0000
Subject: Re: ENUM type
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5875@lists.php.net to get a copy of this message
At 9:49 PM +0700 1/15/01, Cahyo S. Aji wrote:
I don't know what is the benefit if we use ENUM type. can everybody explain it?
Examples: It looks like a character column, but it's represented as an integer, so operations on it can be quite fast. The numeric representation also takes less space, in most cases. By using it, you make the legal values for a column explicit in the column definition. You can look up the legal values for the column from within programs. For example, you can parse SHOW COLUMNS LIKE 'col_name' output to get the legal enumeration values, then use them to construct a set of radio buttons or a popup menu in a web form. That way your form always presents exactly the legal options for the column. You can also use the column definition when validating submitted forms to make sure the value submitted is legal. -- Paul DuBois, paul@snake.net

« previous php.db (#5875) next »