1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    i am trying to create a table in mysql :-

    create table test (en1 (enum('Y','N' default 'N' not null, id int auto_increment primary key, field1 char(10));

    when i insert using :-

    insert into test('1',null,'test');

    then i check the values in the test using select :-

    en1 id field1
    1 test

    the value in en1 is null ? when i specify it is not null.

    i am trying to make the en1 as a boolean field which can accept 1 or 0 or y or n.

    how do i do that and also the not null - it must be a not null ?

    lost .... in mysql...

    please help....

    thanks a lot
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    The problem is when you make the table you are using incorrect syntax.

    Here is the proper syntax you should be using:

    create table test(
    en1 enum('Y','N') not null default 'N',
    id int not null auto_increment,
    field1 varchar(10),
    primary key (id),

    Hope that helps...

Similar Threads

  1. mySQL Values
    By XSilverSwordX in forum MySQL Help
    Replies: 8
    Last Post: September 25th, 2003, 07:56 AM
  2. making this code MySQL 4.0.13 compliant
    By Gappa in forum MySQL Help
    Replies: 1
    Last Post: June 20th, 2003, 09:57 PM
  3. IF Statements, I don't get them.
    By IwanaLearn in forum PHP Development
    Replies: 8
    Last Post: December 6th, 2002, 09:04 AM
  4. php with statement to mysql, rookie in over his head
    By jim.hodgson in forum PHP Development
    Replies: 3
    Last Post: August 6th, 2001, 12:08 PM
  5. Uknow Known MYSQLERROR
    By andyw in forum MySQL Help
    Replies: 7
    Last Post: January 23rd, 2001, 09:34 AM

IMN logo majestic logo threadwatch logo seochat tools logo