Your example is not the same, it sends only one value
to a 2 value table.  It definetely does not work if you send NULL

INSERT VALUES(NULL)


Ruben

On 2002.04.12 14:10 Michael Stassen wrote:
> 
> On Fri, 12 Apr 2002, Steve Katen wrote:
> 
> > Ruben,
> >
> > If you leave it as NOT NULL it should default to NO.  "If an ENUM is
> > declared NOT NULL, the default value is the first element of the list of
> > allowed values."
> >
> > SIDE QUESTION:
> > Are you doing something like: select * from table where enum_colum="NO"
> >
> > If you are running that type of query it won't work because enum does not
> > store the values you put in.  it stores an index.
> 
> Huh?  It works for me (in 3.23.44).  Consider
> 
> mysql> CREATE TABLE enum_test (
>     ->    id INT UNSIGNED NOT NULL AUTO_INCREMENT,
>     ->    enum_column ENUM('No','Yes') NOT NULL,
>     ->    PRIMARY KEY  (id)
>     ->    );
> Query OK, 0 rows affected (0.00 sec)
> 
> mysql> INSERT INTO enum_test (enum_column)
>     -> VALUES ('No'), ('Yes'), ('Yes'), ('No'), ('No'), ('No'), ('Yes');
> Query OK, 7 rows affected (0.00 sec)
> Records: 7  Duplicates: 0  Warnings: 0
> 
> mysql> SELECT * FROM enum_test WHERE enum_column='No';
> +----+-------------+
> | id | enum_column |
> +----+-------------+
> |  1 | No          |
> |  4 | No          |
> |  5 | No          |
> |  6 | No          |
> +----+-------------+
> 4 rows in set (0.00 sec)
> 
> I don't think enums would be very useful if this weren't the case.
> 
> Of course, the manual <http://www.mysql.com/doc/E/N/ENUM.html> is very
> unclear on this.  It's so busy explaining the the special cases (NULL,
> invalid insert, numerical value, sorting, etc.) that it does not give a
> single example of using the enumerated values in a select or insert.
> That should probably be remedied.
> 
> Michael
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
-- 
__________________________

Brooklyn Linux Solutions
__________________________
http://www.mrbrklyn.com - Consulting
http://www.brooklynonline.com - For the love of Brooklyn
http://www.nylxs.com - Leadership Development in Free Software
http://www.nyfairuse.org - The foundation of Democracy
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from 
around the net
http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you...
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn....

1-718-382-5752




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to