What is the SQL query to display the current date?

There is a built-in function in SQL called GetDate() which is used to return the current timestamp.

In SQL, you can use the GETDATE() or CURRENT_TIMESTAMP function to retrieve the current date and time. If you only want the current date, you can use the CAST or CONVERT functions to extract the date part. Here are a couple of examples:

  1. Using GETDATE():
SELECT GETDATE() AS CurrentDateAndTime;
  1. Using CURRENT_TIMESTAMP:
SELECT CURRENT_TIMESTAMP AS CurrentDateAndTime;
  1. Extracting only the date using CAST or CONVERT:
-- Using CAST
SELECT CAST(GETDATE() AS DATE) AS CurrentDate;
— Using CONVERT
SELECT CONVERT(DATE, GETDATE()) AS CurrentDate;

Any of these queries should give you the current date or date and time, depending on your specific requirements.