0
0
MySQLquery~10 mins

STR_TO_DATE parsing in MySQL - Interactive Code Practice

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

Complete the code to convert the string '2024-06-15' to a date using STR_TO_DATE.

MySQL
SELECT STR_TO_DATE('2024-06-15', [1]);
Drag options to blanks, or click blank then click option'
A'%Y-%m-%d'
B'%d/%m/%Y'
C'%m-%d-%Y'
D'%Y/%d/%m'
Attempts:
3 left
💡 Hint
Common Mistakes
Using slashes '/' instead of dashes '-' in the format string.
Mixing up the order of day and month.
2fill in blank
medium

Complete the code to parse '15/06/2024' into a date using STR_TO_DATE.

MySQL
SELECT STR_TO_DATE('15/06/2024', [1]);
Drag options to blanks, or click blank then click option'
A'%Y-%m-%d'
B'%d/%m/%Y'
C'%m/%d/%Y'
D'%Y/%d/%m'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '%m/%d/%Y' which expects month first.
Using dashes '-' instead of slashes '/'.
3fill in blank
hard

Fix the error in the code to correctly parse '06-15-2024' as a date.

MySQL
SELECT STR_TO_DATE('06-15-2024', [1]);
Drag options to blanks, or click blank then click option'
A'%Y-%d-%m'
B'%d-%m-%Y'
C'%Y-%m-%d'
D'%m-%d-%Y'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping day and month in the format string.
Using year first format incorrectly.
4fill in blank
hard

Complete the code to parse '15-JUN-2024' into a date using STR_TO_DATE.

MySQL
SELECT STR_TO_DATE('15-JUN-2024', [1]);
Drag options to blanks, or click blank then click option'
A'%Y-%b-%d'
B'%d-%B-%Y'
C'%d-%b-%Y'
D'%m-%d-%Y'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '%B' which expects full month name.
Mixing up the order of day and month.
5fill in blank
hard

Complete the code to parse '2024 June 15' into a date using STR_TO_DATE.

MySQL
SELECT STR_TO_DATE('2024 June 15', [1]);
Drag options to blanks, or click blank then click option'
A'%Y %B %d'
B'%Y %b %d'
C'%d'
D'%m'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '%b' which expects abbreviated month name.
Mixing up day and month positions.