0
0
SQLquery~20 mins

CURRENT_DATE and CURRENT_TIMESTAMP in SQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Date and Time Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
1:30remaining
What is the output of CURRENT_DATE?
Consider the SQL query:
SELECT CURRENT_DATE;

What type of value does this query return?
SQL
SELECT CURRENT_DATE;
AThe current date and time as a timestamp (e.g., '2024-06-15 14:30:00')
BA string showing the day of the week (e.g., 'Monday')
CThe current time only (e.g., '14:30:00')
DThe current date as a date value without time (e.g., '2024-06-15')
Attempts:
2 left
💡 Hint
CURRENT_DATE returns only the date part, no time included.
query_result
intermediate
1:30remaining
What does CURRENT_TIMESTAMP return?
Look at this SQL query:
SELECT CURRENT_TIMESTAMP;

What kind of value will this return?
SQL
SELECT CURRENT_TIMESTAMP;
AThe current date and time as a timestamp (e.g., '2024-06-15 14:30:00')
BThe current time only (e.g., '14:30:00')
CThe current date only (e.g., '2024-06-15')
DThe current year as a number (e.g., 2024)
Attempts:
2 left
💡 Hint
CURRENT_TIMESTAMP includes both date and time.
🧠 Conceptual
advanced
2:00remaining
Difference between CURRENT_DATE and CURRENT_TIMESTAMP
Which statement correctly describes the difference between CURRENT_DATE and CURRENT_TIMESTAMP in SQL?
ABoth return the same value but in different formats.
BCURRENT_DATE returns date and time, while CURRENT_TIMESTAMP returns only the date.
CCURRENT_DATE returns only the date, while CURRENT_TIMESTAMP returns date and time.
DCURRENT_DATE returns the time only, CURRENT_TIMESTAMP returns date only.
Attempts:
2 left
💡 Hint
Think about what parts of the date/time each function includes.
📝 Syntax
advanced
2:00remaining
Which SQL query correctly uses CURRENT_TIMESTAMP to insert current date and time?
You want to insert the current date and time into a table named 'events' with a column 'event_time'. Which query is correct?
AINSERT INTO events (event_time) VALUES (CURRENT_TIMESTAMP);
BINSERT INTO events (event_time) VALUES CURRENT_TIMESTAMP;
CINSERT INTO events (event_time) VALUES 'CURRENT_TIMESTAMP';
DINSERT INTO events (event_time) VALUES (CURRENT_DATE);
Attempts:
2 left
💡 Hint
Remember to use parentheses around function calls in VALUES.
🔧 Debug
expert
2:30remaining
Why does this query cause an error?
Given the query:
SELECT CURRENT_DATE + CURRENT_TIMESTAMP;

Why does this cause an error?
SQL
SELECT CURRENT_DATE + CURRENT_TIMESTAMP;
AThe query is missing a FROM clause.
BYou cannot add a date and a timestamp directly; they are different types.
CCURRENT_DATE and CURRENT_TIMESTAMP are not valid SQL functions.
DThe plus sign (+) is not allowed in SQL queries.
Attempts:
2 left
💡 Hint
Think about the data types and what operations are allowed between them.