0
0
SQLquery~10 mins

CURRENT_DATE and CURRENT_TIMESTAMP in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select the current date.

SQL
SELECT [1];
Drag options to blanks, or click blank then click option'
ACURRENT_DATE
BNOW()
CGETDATE()
DTODAY
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW() which returns date and time instead of just date.
Using GETDATE() which is specific to some SQL dialects.
Using TODAY which is not a valid SQL function.
2fill in blank
medium

Complete the code to select the current date and time.

SQL
SELECT [1];
Drag options to blanks, or click blank then click option'
ACURRENT_DATE
BDATE()
CCURDATE()
DCURRENT_TIMESTAMP
Attempts:
3 left
💡 Hint
Common Mistakes
Using CURRENT_DATE which returns only the date.
Using CURDATE() which is MySQL specific and returns only the date.
Using DATE() which extracts date from a datetime but is not a function to get current timestamp.
3fill in blank
hard

Fix the error in the code to get the current timestamp.

SQL
SELECT [1] FROM dual;
Drag options to blanks, or click blank then click option'
ACURRENT_DATE
BNOW()
CCURRENT_TIMESTAMP
DGETDATE()
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW without parentheses which causes syntax error.
Using GETDATE() which is SQL Server specific and may not work in all SQL dialects.
Using CURRENT_DATE which returns only the date.
4fill in blank
hard

Fill both blanks to select the current date and current timestamp in one query.

SQL
SELECT [1] AS today, [2] AS now;
Drag options to blanks, or click blank then click option'
ACURRENT_DATE
BCURRENT_TIMESTAMP
CNOW()
DGETDATE()
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW() for the date which returns date and time.
Using GETDATE() which is not standard SQL.
Mixing functions from different SQL dialects.
5fill in blank
hard

Fill all three blanks to create a table showing current date, current timestamp, and the difference in days between them (should be zero).

SQL
SELECT [1] AS current_date, [2] AS current_timestamp, DATEDIFF(day, [1], [2]) AS diff_days;
Drag options to blanks, or click blank then click option'
ACURRENT_DATE
BCURRENT_TIMESTAMP
CNOW()
DGETDATE()
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW() or GETDATE() inconsistently causing errors.
Mixing date and timestamp functions from different SQL dialects.
Incorrect order of arguments in DATEDIFF.