Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2012
    Posts
    3

    Unanswered: date type question

    I just joined.
    Thought i ask you guys a little about the date type.

    I have been playing around a little with mysql ( version 5.1.63-0+squeeze1 ) and created a test db.
    I followed this example in a book, but wasn't able to create two columns with date as type on them.
    I tried some different approaches and was able to create everything else except the two columns ( see below ) what is the best way to go.

    CREATE TABLE employee
    -> ( firstname varchar(30),
    -> lastname varchar(30),
    -> start date,
    -> retirement date
    );

    The example above i a simplified version of the table. How should i specify the date type instead for columns,
    do i need to be more specific ? with yy-mm-dd or something like that.

    Thanks in advance guys...

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what you have posted is just fine for the date columns (except you might want to check that START isn't a reserved word)

    your table has no primary key but you weren't asking about that
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2004
    Posts
    480
    The example above i a simplified version of the table
    show us the table you were creating where you actually had trouble.

  4. #4
    Join Date
    Jul 2012
    Posts
    3

    Thanks guys for yout replies..

    Yes i could be that start is a reserved word. Didn' t think about that.
    I will try some more testing. Yes i know the example didn't have any primary key.
    It was a little more compressed version of the actual table..

    Once again guys big thanks..

    I will try to rename the column named start to something else...

  5. #5
    Join Date
    Mar 2004
    Posts
    480
    START isn't a reserved word STARTING is a reserved word though.

  6. #6
    Join Date
    Jul 2012
    Posts
    3
    : ) Ok i didn't know that before.
    But mayby i did in a way yet. I tryid some different suggestions & solutions ie i mada a db for testing purposes with a table and included the start column with date, and it did work just fine, after that i got into some other stuff.

    This seems like an active board, really good and i like it a lot.

    Thank for the info regarding started guelphdad..

Posting Permissions

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