Which SQL function is used to return the current date and time?

Which SQL function is used to return the current date and time?

a) NOW()
b) GETDATE()
c) CURRENT_TIMESTAMP
d) All of the above

Answer:

d) All of the above

Explanation:

The functions NOW(), GETDATE(), and CURRENT_TIMESTAMP all return the current date and time in SQL. The exact function used may vary depending on the database system, but all serve the same purpose.

NOW() and CURRENT_TIMESTAMP are commonly used in MySQL and PostgreSQL, while GETDATE() is specific to Microsoft SQL Server.

These functions are useful in applications that need to log or display the current date and time, such as in logging systems or for tracking when records were created or updated.

Reference:

Database Management System MCQ (Multiple Choice Questions)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top