SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: MYSQL help needed

  1. #1
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy MYSQL help needed

    Hi All

    I am having troubles trying to create my first table in mysql

    I am using version 5.0

    I have entered the code below in mysql:

    mysql>CREATE TABLE table_name (
    -> column_1_name column_1_type column_1_details,
    -> column_2_name column_2_type column_2_details,
    -> ...
    ->);

    and i get the following error:

    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 'column_1_type column_1_details,column_2_name column_2_type column_2_details,' at line 2

    Anyone able to help?

  2. #2
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,462
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    "column_1_type" is not a valid datatype

    you need something like DATETIME, INTEGER, or VARCHAR(42)

    nor will "column_1_details" work either, you actually have to code some valid details, like PRIMARY KEY, NOT NULL, DEFAULT 'no way', and so on
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •