
Tesco: Date Function

Quiz
•
Professional Development
•
Professional Development
•
Hard

Ivy Professional School
FREE Resource
8 questions
Show all answers
1.
OPEN ENDED QUESTION
2 mins • Ungraded
Full Name
Evaluate responses using AI:
OFF
2.
OPEN ENDED QUESTION
2 mins • Ungraded
Email ID
Evaluate responses using AI:
OFF
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Which statement correctly finds the number of days between two dates in MySQL?
SELECT DAYS_BETWEEN(date1, date2);
SELECT DATE_SUB(date1, date2);
SELECT DATEDIFF(date1, date2);
SELECT DATE_DIFFERENCE(date1, date2);
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
If you want to retrieve all sales transactions that happened in the first quarter (Jan-Mar), which query should you use?
SELECT * FROM Sales WHERE MONTH(Date) IN (1, 2, 3);
SELECT * FROM Sales WHERE QUARTER(Date) = 1;
SELECT * FROM Sales WHERE EXTRACT(QUARTER FROM Date) = 1;
All of the above
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
How do you retrieve the year and month from a column named order_date?
SELECT YEAR(order_date), MONTH(order_date) FROM orders;
SELECT EXTRACT(YEAR FROM order_date), EXTRACT(MONTH FROM order_date) FROM orders;
Both
None of the above
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Your company wants to find employees who joined this year. The employees table has a column hire_date (DATE format). Which query correctly retrieves employees who joined in the current year?
SELECT * FROM employees WHERE YEAR(hire_date) = CURRENT_DATE;
SELECT * FROM employees WHERE YEAR(hire_date) = YEAR(CURRENT_DATE());
SELECT * FROM employees WHERE hire_date = GETDATE();
SELECT * FROM employees WHERE DATE_PART('year', hire_date) = NOW();
7.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
A banking system needs to find out the age of customers based on their birth_date. Which SQL query correctly calculates the age?
SELECT TIMESTAMPDIFF(YEAR, birth_date, CURDATE()) AS age FROM customers;
SELECT birth_date - CURRENT_DATE AS age FROM customers;
SELECT DATEDIFF(birth_date, CURDATE(), YEAR) / 365 AS age FROM customers;
8.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Your company is sending birthday discounts to customers whose birthdays fall in the current month. Which query is correct?
SELECT * FROM customers WHERE MONTH(birth_date) = MONTH(NOW());
SELECT * FROM customers WHERE DATE_PART('month', birth_date) = CURRENT_DATE();
SELECT * FROM customers WHERE EXTRACT(MONTH FROM birth_date) IN EXTRACT(MONTH FROM NOW());
None
Similar Resources on Wayground
8 questions
BP Internal training - 05.2024/2

Quiz
•
Professional Development
8 questions
HCOLA PPS Quiz

Quiz
•
Professional Development
10 questions
data ethics

Quiz
•
KG - Professional Dev...
10 questions
ESOP

Quiz
•
Professional Development
11 questions
Sequium Refresher

Quiz
•
Professional Development
11 questions
AE/PC Reporting Quiz

Quiz
•
Professional Development
11 questions
Noom | Day 7 Billing

Quiz
•
Professional Development
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade