Q5: Find employees hired in the current year.
In this query, we want to find employees who joined the company during the current year.
First, we extract the year from each employee’s join_date:
EXTRACT(YEAR FROM join_date)
Then we compare it with the current year using:
EXTRACT(YEAR FROM CURRENT_DATE)
The CURRENT_DATE function gives us today’s date, and EXTRACT(YEAR FROM ...) gets the year from that date.
SELECT * FROM employees WHERE EXTRACT(YEAR FROM join_date) = EXTRACT(YEAR FROM CURRENT_DATE);

So essentially, SQL is asking:
Does the employee’s join year equal the current year?
In the result, we get 4 employees who joined in 2026: James Anderson, Daniel Wilson, Robert Moore, and Susan Thompson.
This technique is very useful when working with dates—for example, finding employees who joined this year, orders placed this year, or customers who signed up this year.
So remember: EXTRACT lets you pull a specific part of a date, such as the year, month, or day, and use it in your SQL queries.