Search Header Logo

Tesco: Date Function

Authored by Ivy Professional School

Professional Development

Professional Development

Tesco: Date Function
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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;

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Professional Development