Courseiva

DA0-002 Data Acquisition and Preparation Practice Question

A data analyst wants to extract the year from a date column 'order_date' in a SQL database. Which function should be used?

⚠ Common exam trap

DA0-002 often tests the confusion between functions that extract date parts and those that manipulate or compare dates, leading candidates to pick DATEADD or DATEDIFF.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

YEAR(order_date)

The YEAR() function is a standard SQL date function that extracts the year from a date or datetime expression. It takes a single argument, the date column, and returns an integer representing the year. This is the most direct and appropriate function for the task.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    YEAR(order_date)

    Why this is correct

    The YEAR() function extracts the year component from a date or timestamp value, returning an integer. Applied to 'order_date', it isolates the year portion, satisfying the requirement to extract the year from that column in a single SQL expression.

  • ✗

    DATEADD(year, order_date, 0)

    Why it's wrong here

    DATEADD adds an integer to a date and returns a date, so passing order_date as the number argument fails and no year is extracted. It is tempting because it names the year date part, but it is built for shifting dates by intervals, not isolating a component.

  • ✗

    DATEDIFF(year, order_date, GETDATE())

    Why it's wrong here

    DATEDIFF returns the count of year boundaries crossed between two dates, not the year component of order_date. It is tempting because it accepts a date part and date arguments, but it is designed for interval arithmetic, whereas YEAR() extracts the calendar year directly.

  • ✗

    GETDATE()

    Why it's wrong here

    GETDATE() returns the current system date and time, so it ignores order_date entirely and yields today's year for every row. It is tempting because it returns a date value, but it is designed for timestamping current events, not extracting a component from a stored column.

About these practice questions

This DA0-002 question is part of Courseiva's 1,004-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

This DA0-002 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DA0-002 exam.