ERROR 1064 (42000): You have an error in your SQL syntax;

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Doug Gentry
    New Member
    • Dec 2010
    • 3

    ERROR 1064 (42000): You have an error in your SQL syntax;

    In my book build your own database driven web site using php and mysql on page 61 it's covering creating a table.

    I think I'm typing this in correctly and I'm getting a error. I just don't see what I'm typing in wrong unless it's the : but in the book it almost looks like 2 of those on top of each other.

    This is what I get..

    mysql> CREATE TABLE table_name (
    -> column1Name column1Type column1Details,
    -> column2Name column2Type column2Details,
    -> :
    -> ) DEFAULT CHARACTER SET charset;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near 'colum
    n1Type column1Details,
    column2Name column2Type column2Details,
    :
    ) DEFAULT ' at line 2


    Any help would be greatly appreciated.
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Burn the book.
    This is the syntax for create table
    Code:
    CREATE TABLE table_name(column1Name VARCHAR(30), column2Type VARCHAR(30), 
    numcolumnname INT, datecolumnname DATETIME)
    The > and -> depend on the environment you are using the query but don't bother in a php mysql_query(),
    and ignore the DEFAULT CHARACTER SET.

    Comment

    • Doug Gentry
      New Member
      • Dec 2010
      • 3

      #3
      Ah thanks you so very much!

      Comment

      Working...