Mixserhacker
Shonen Battle Strategist
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
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