0
0
MySQLquery~10 mins

Why date handling is essential in MySQL - Test Your Understanding

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

Complete the code to select all records where the date is exactly '2024-06-01'.

MySQL
SELECT * FROM events WHERE event_date = '[1]';
Drag options to blanks, or click blank then click option'
A2024-06-01
B06-01-2024
C2024/06/01
DJune 1, 2024
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-standard date formats like '06-01-2024' or 'June 1, 2024' causes no matches.
2fill in blank
medium

Complete the code to find all records where the date is after '2024-01-01'.

MySQL
SELECT * FROM orders WHERE order_date [1] '2024-01-01';
Drag options to blanks, or click blank then click option'
A=
B<
C>
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' or '<=' will select dates before or on the given date, not after.
3fill in blank
hard

Fix the error in the query to select records where the date is between '2024-01-01' and '2024-06-01'.

MySQL
SELECT * FROM sales WHERE sale_date [1] '2024-01-01' AND sale_date [2] '2024-06-01';
Drag options to blanks, or click blank then click option'
A>=
B<
C<=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' or '<' excludes the boundary dates from the results.
4fill in blank
hard

Fill both blanks to select records where the date is in June 2024 using the BETWEEN operator.

MySQL
SELECT * FROM appointments WHERE appointment_date BETWEEN '[1]' AND '[2]';
Drag options to blanks, or click blank then click option'
A2024-06-01
B2024-05-31
C2024-06-30
D2024-07-01
Attempts:
3 left
💡 Hint
Common Mistakes
Using dates outside June will include unwanted records.
5fill in blank
hard

Fill all three blanks to select records where the date is in 2024 and the month is June.

MySQL
SELECT * FROM meetings WHERE YEAR(meeting_date) = [1] AND MONTH(meeting_date) = [2] AND DAY(meeting_date) [3] 15;
Drag options to blanks, or click blank then click option'
A2024
B6
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong month number or wrong comparison operator for the day.