• We just launched and are currently in beta. Join us as we build and grow the community.

SQL NOW() Function

Mixserhacker

Shonen Battle Strategist
M Rep
0
0
0
Rep
0
M Vouches
0
0
0
Vouches
0
Posts
126
Likes
91
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 100 XP
The NOW() function is an aggregate function used to return the date and time along with other column.

The NOW() function returns the result as dd/mm/yyyy HH:MM:SS AM/PM depending on your regional settings.

SQL NOW() Syntax

SELECT

column_name(

s)

,

NOW(

)

FROM

TABLE

Consider the following table for this exercise

Users

Firstname

Lastname

Salary

DeptID

John

Smith

1000

1

Mathew

Simon

3000

1

Bill

Steve

2200

1

Amanda

Rogers

1800

2

Steve

Hills

2800

2

Steve

jobs

2400

2

bill

cosby

700

3

Example # 1

SELECT

Salary,

NOW(

)

AS

TILL_date FROM

Users

Result of the Query

Salary

TILL_date

1000

23/03/2011 03:24:06 AM

3000

23/03/2011 03:24:06 AM

2200

23/03/2011 03:24:06 AM

1800

23/03/2011 03:24:06 AM

2800

23/03/2011 03:24:06 AM

2400

23/03/2011 03:24:06 AM

700

23/03/2011 03:24:06 AM

 

452,496

337,656

337,664

Top