Hi,
Use enum with a default type and let mysql do the check for you.
The problem with an enum is that if you insert a value that's not in
the enum, MySQL doesn't stop the insert, it leaves the column empty.
This doesn't enforce data integrity like I think Chris wanted.
mysql> desc enum_test;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | enum('test1','test2') | YES | | test2 | |
+-------+-----------------------+------+-----+---------+-------+
2 rows in set (0.25 sec)
mysql> INSERT INTO enum_test VALUES (1,'test3');
Query OK, 1 row affected, 1 warning (0.29 sec)
mysql> SELECT * from enum_test;
+------+------+
| id | name |
+------+------+
| 1 | |
+------+------+
1 row in set (0.00 sec)
Mike Kruckenberg
[EMAIL PROTECTED]
"ProMySQL" Author
http://www.amazon.com/exec/obidos/ASIN/159059505X
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]