List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:April 12 2002 5:20pm
Subject:Re: ENUM Default values on NULL
View as plain text  

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. 


It most certainly will work.

>
>
> if you create the table with enum("NO","YES") then you should be able 
> to do a select * from table where enum_column=1
>
> that should return everything with a NO value.
>
> Go read the documentation and see what it has to say:
> http://www.mysql.com/documentation/mysql/full/manual_toc.html#ENUM
>
> katen
>
> At 12:24 PM 4/12/2002 -0400, Ruben I Safir wrote:
>
>> sql
>>
>> > > ENUM can handle your needs.  you should be able to just change 
>> your syntax
>> > > to: FIELD ENUM('NO','YES') NULL
>> > >
>> > > under that syntax your default value will be NULL.
>> > >
>> > I need it to default to 'NO' not NULL
>
>
>
>
> ---------------------------------------------------------------------
> 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 <mysql-thread105978@stripped>
> To unsubscribe, e-mail 
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


Thread
Re: ENUM Default values on NULLRuben I Safir12 Apr
  • Re: ENUM Default values on NULLSteve Katen12 Apr
    • Re: ENUM Default values on NULLRuben I Safir12 Apr
Re: ENUM Default values on NULLRuben I Safir12 Apr
  • Re: ENUM Default values on NULLSteve Katen12 Apr
    • Re: ENUM Default values on NULLRuben I Safir12 Apr
      • Re: ENUM Default values on NULLSteve Katen12 Apr
      • Re: ENUM Default values on NULLMichael Stassen12 Apr
    • Re: ENUM Default values on NULLMichael Stassen12 Apr
      • Re: ENUM Default values on NULLRuben I Safir12 Apr
        • Re: ENUM Default values on NULLMichael Stassen12 Apr
Re: ENUM Default values on NULLGerald Clark12 Apr