0
0
MySQLquery~20 mins

NOW, CURDATE, CURTIME in MySQL - 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 does the query return?
Consider the query:
SELECT CURDATE();

What is the output format of this query?
MySQL
SELECT CURDATE();
AA string in 'HH:MM:SS' format representing current time
BA string in 'YYYY-MM-DD' format representing today's date
CA datetime value including date and time
DAn integer representing the current timestamp
Attempts:
2 left
💡 Hint
CURDATE() returns only the date part, not time.
query_result
intermediate
1:30remaining
What is the output of NOW()?
Given the query:
SELECT NOW();

What does this function return?
MySQL
SELECT NOW();
AOnly the current time in 'HH:MM:SS' format
BOnly the current date in 'YYYY-MM-DD' format
CThe current date and time as a datetime value in 'YYYY-MM-DD HH:MM:SS' format
DThe Unix timestamp as an integer
Attempts:
2 left
💡 Hint
NOW() returns both date and time.
query_result
advanced
1:30remaining
What is the output of CURTIME()?
What does the query below return?
SELECT CURTIME();
MySQL
SELECT CURTIME();
AThe current time as a string in 'HH:MM:SS' format
BThe current date as a string in 'YYYY-MM-DD' format
CThe current date and time as a datetime value
DThe current Unix timestamp as an integer
Attempts:
2 left
💡 Hint
CURTIME() returns only the time part.
🧠 Conceptual
advanced
1:30remaining
Difference between NOW() and CURDATE()
Which statement correctly describes the difference between NOW() and CURDATE() in MySQL?
ANOW() returns current date and time; CURDATE() returns only the current date
BNOW() returns only the current time; CURDATE() returns current date and time
CNOW() returns Unix timestamp; CURDATE() returns date as string
DNOW() returns only the current date; CURDATE() returns only the current time
Attempts:
2 left
💡 Hint
Think about what each function returns: date, time, or both.
📝 Syntax
expert
2:00remaining
Which query will cause an error?
Identify which of the following queries will cause a syntax error in MySQL.
ASELECT NOW();
BSELECT CURDATE();
CSELECT CURTIME();
DSELECT NOW(5);
Attempts:
2 left
💡 Hint
Check if NOW() accepts any arguments.