sql now()

SQL Functions




  • The NOW() Function

    The NOW() function returns the current system date and time.

    SQL NOW() Syntax

    SELECT NOW() FROM table_name

  • SQL NOW() Example

    Table Name ” Distance”

    Point distance(KM)
    AtoB 5.4
    XtoZ 15.7
    BtoE 4.9

    Now we want to display the products and prices per today’s date.

    We use the following SELECT statement:

    SELECT Point, Unitdistance, Now() as Date FROM emp

    The result-set will look like this:

    Point Unitdistance Date
    AtoB 5.4 16/8/2012 12:54:59 AM
    XtoZ 15.7 26/8/2013 1:54:29 PM
    BtoE 4.9 17/1/2012 10:44:09 AM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s