MySQL create table problem

Discussion in 'MySQL' started by Krystal, Aug 15, 2008.

  1. #1
    I'm trying to create a table with a date column. Here is the code I'm using:

    CREATE TABLE clicks 
    (
    X varchar(15),
    Y varchar(15),
    ClickDate date(yyyy-mm-dd)
    )
    Code (markup):
    It wasn't working as part of my php script so I put the above inserted directly to the SQL query on phpmyadmin to see the error. Here is the error I got:

    Without the date part it works fine. What's the problem

    thanks in advance :)
     
    Krystal, Aug 15, 2008 IP
  2. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Try using in uppercase: YYYY-MM-DD
     
    rohan_shenoy, Aug 16, 2008 IP
  3. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #3
    Just use date instead of date(yyyy-mm-dd). It will by defualt use yyyy-mm-dd format.

    CREATE TABLE clicks 
    (
    X varchar(15),
    Y varchar(15),
    ClickDate date)
    Code (markup):
    Kailash
     
    kailash, Aug 16, 2008 IP
  4. gramyla

    gramyla Peon

    Messages:
    71
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The code suggested by Kailash i always used in this type of coding and it works.
     
    gramyla, Aug 19, 2008 IP