#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    3
    Rep Power
    0

    "ERROR 1113: A table must have at least 1 column"


    Hi all,

    Here's the problem of mine,
    I'll create or open a db alright,
    then I go to create a table, and here's what I get:

    Originally Posted by PT
    mysql> CREATE TABLE (table name)
    ERROR 1113: A table must have at least 1 column
    I need help with:

    Creating columns.

    What all this NOT NULL etc, stuff is.

    And what is VARCHAR?

    Thanks in advance,
    PT
  2. #2
  3. No Profile Picture
    I AM A GOLDEN GOD
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Apr 2003
    Location
    Camarillo, California
    Posts
    5,932
    Rep Power
    1166
    Everything is outlined in the MySQL manual, specifically the sections 'MySQL Tutorial', 'Creating a table', and 'Column Types'.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    ...


    Hey man,

    first, and most important:

    - VARCHAR as INT or CHAR are "datatypes", or types of variables...
    - VARCHAR is the type normaly used to get strings
    - NOT NULL indicates the restriction (if you'll can leave this table field empty - with a null value)

    ok, the other important thing you will need know is about the Primary Key
    this table field will identify each row of your table
    this will need a unique value (each row will have a unique key)
    this is important becouse is this the column that will identify specific data in your table

    well, one example may be this way:

    CREATE TABLE student (
    code_stdt INTEGER not null,
    name_stdt VARCHAR(70) not null,
    nota_stdt FLOAT,
    PRIMARY KEY (code_stdt)
    )



    > I hope to have helped...
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,205
    Rep Power
    4279
    Originally Posted by patrickpff
    > I hope to have helped...
    nice one, but i really doubt the original poster has waited these eight years for your reply

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo