Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to get the current date and time using MySQL.
MySQL
SELECT [1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using CURDATE() when you want date and time.
Using CURTIME() when you want date and time.
✗ Incorrect
The NOW() function returns the current date and time in MySQL.
2fill in blank
mediumComplete the code to get only the current date in MySQL.
MySQL
SELECT [1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW() when only the date is needed.
Using CURTIME() which returns only time.
✗ Incorrect
The CURDATE() function returns only the current date in MySQL.
3fill in blank
hardFix the error in the code to get the current time in MySQL.
MySQL
SELECT [1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using CURDATE() when time is needed.
Using NOW() when only time is needed.
✗ Incorrect
The CURTIME() function returns only the current time in MySQL.
4fill in blank
hardFill both blanks to select current date and current time separately.
MySQL
SELECT [1]() AS today, [2]() AS now_time;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW() for both blanks.
Mixing CURDATE() and NOW() in wrong order.
✗ Incorrect
CURDATE() returns the current date, and CURTIME() returns the current time.
5fill in blank
hardFill all three blanks to select current date, current time, and current date and time.
MySQL
SELECT [1]() AS current_date, [2]() AS current_time, [3]() AS current_datetime;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW() for all three blanks.
Confusing CURDATE() and CURRENT_DATE() functions.
✗ Incorrect
CURDATE() returns the current date, CURTIME() returns the current time, and NOW() returns both date and time.