Inserting values into a table with two timestamp fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • praveena mani
    New Member
    • Sep 2007
    • 16

    #1

    Inserting values into a table with two timestamp fields

    how to insert values in this table for these two timestamps???
    [code=mysql]
    create table s_details(
    SELECT_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    TITLE varchar(4) NOT NULL,
    FIRST_NAME varchar(20) NOT NULL,
    MIDDLE_NAME varchar(20),
    LAST_NAME varchar(20) NOT NULL,
    DATE_OF_BIRTH date NOT NULL,
    NATIONALITY varchar(20) ,
    E_MAIL varchar(30) NOT NULL,
    DATE_OF_ENTRY_O F_DETAILS TIMESTAMP DEFAULT 0,
    MODIFIED_DATE timestamp NOT NULL DEFAULT CURRENT_TIMESTA MP ON UPDATE CURRENT_TIMESTA MP,
    );[/code]
    Last edited by pbmods; Sep 19 '07, 12:57 PM. Reason: Added CODE tags.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Praveena. Welcome to TSDN!

    Please use CODE tags when posting source code:

    [CODE=My SQL]
    MySQL code goes here.
    [/CODE]

    Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

    Are you asking how to issue an INSERT query?

    Comment

    • praveena mani
      New Member
      • Sep 2007
      • 16

      #3
      yeah,how to insert values for this table?
      jus gimme an example to insert values..

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Praveena.

        Well, I'd guess it would work something like this:
        [code=mysql]
        INSERT
        INTO
        `s_details`
        (
        `TITLE`,
        `FIRST_NAME`,
        `MIDDLE_NAME`,
        `LAST_NAME`,
        `DATE_OF_BIRTH` ,
        `NATIONALITY`,
        `E_MAIL`,
        `DATE_OF_ENTRY_ OF_DETAILS`
        )
        VALUES
        (
        'title',
        'first name',
        'middle name',
        'last name'
        'date of birth',
        'nationality',
        'email',
        CURRENT_TIMESTA MP
        )
        [/code]

        You don't need to specify a value for the `SELECT_ID` and `MODIFIED_DATE` fields; they will be automatically set for you.

        Comment

        • praveena mani
          New Member
          • Sep 2007
          • 16

          #5
          thanx..
          it helped me alot..

          Comment

          Working...