Complete the code to select the current date.
SELECT [1];The CURRENT_DATE keyword returns the current date in SQL.
Complete the code to select the current date and time.
SELECT [1];The CURRENT_TIMESTAMP keyword returns the current date and time in SQL.
Fix the error in the code to get the current timestamp.
SELECT [1] FROM dual;In standard SQL, CURRENT_TIMESTAMP returns the current date and time. The dual table is used in some databases like Oracle.
Fill both blanks to select the current date and current timestamp in one query.
SELECT [1] AS today, [2] AS now;
CURRENT_DATE returns the current date, and CURRENT_TIMESTAMP returns the current date and time.
Fill all three blanks to create a table showing current date, current timestamp, and the difference in days between them (should be zero).
SELECT [1] AS current_date, [2] AS current_timestamp, DATEDIFF(day, [1], [2]) AS diff_days;
CURRENT_DATE and CURRENT_TIMESTAMP are used to get the date and timestamp. The Datediff function calculates the difference in days between them, which should be zero since they represent the same day.