Problems creating tables.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GGawaran
    New Member
    • Mar 2007
    • 24

    #1

    Problems creating tables.

    Ive setup the MySQL server and am using heidi to create the tables, Ive had no trouble creating any new databases or certain tables.

    But my problem im running into right now, im trying to create a tabel called customer_nfo with one variable for ID not null unsigned auto increment, then another with first_name not null.

    ill post the code that heidisql posts

    Code:
    CREATE TABLE customer_info (ID MEDIUMINT (10) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT)
    SELECT CONNECTION_ID()
    USE test
    But to no avail, kinda self teaching myself sql and its just the beginning im having problems with. Could anyone enlighten me on what I may be doing wrong,

    Thanks,

    Greg
  • ScarletPimpernal
    New Member
    • Mar 2007
    • 39

    #2
    Hi

    Once you are specifying the field as a Auto Increment Field then
    U must have to specify that as a key field and u cannot set the default value for that field.

    Here is the Syntax...

    CREATE TABLE customer_info (ID MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);



    Thanks,
    Scarlet.

    Comment

    • GGawaran
      New Member
      • Mar 2007
      • 24

      #3
      Ah I see, but I can also apply other fields , ie first name or what not, or would i want to leave the auto increment field by itself in the table?

      Comment

      Working...