SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie " I can't get Mysql to work

    FAO the Program your site team

    Hi

    I'm having alot of trouble creating my first table for a database I am designing for a friend's website, please let me explain:

    Firstly I can log into Mysql, and select a database to use.

    When it comes to typing the sql syntax:

    CREATE TABLE PRODUCTS (
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    PRODUCT SUPPLIER,
    PRODUCT NAME,
    PRODUCT INFORMATION,
    DATE ADDED,
    );


    This is the code i want to use for the database I am designing, but Mysql keeps coming up with errors, this is proving very frustrating please please can some one tell me where I am going wrong and correct my code so I can complete my database.

    Cheers

    Peter Brook

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,248
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    dangling comma after da last column

    once you've cleared that up, you will also want to remove the spaces from the column names and give them datatypes
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much, so I am assuming that my code should read:

    CREATE TABLE PRODUCTS (
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    PRODUCT SUPPLIER VARCHAR (255),
    PRODUCT NAME VARCHAR (255),
    PRODUCT INFORMATION VARCHAR (255),
    DATE ADDED INT NOT NULL,
    );

    iS

  4. #4
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is that how my code should read?, I haven't tested it yet as i'm just on my way to work, I shall test it later, or can someone please give me the correct syntax so I can use that instead.

    Cheers Peter

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,248
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    you should try it just like that, because it will produce errors, and you need the experience in debugging the errors

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep you're right it still produces errors and I'm no step further to creating my first table for my database what is it I need to change?

    Cheers Peter

  7. #7
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,248
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    what you need to change has already been mentioned in this thread
    rudy.ca | @rudydotca
    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
  •