- Description: Retrieves subparts of a date (e.g., year, month).
- Purpose: Breaking down dates for analysis.
- Syntax:
EXTRACT(field FROM date)
- Parameters:
field
: The part of the date to extract (YEAR, MONTH, DAY, etc.).date
: The date to extract from.
- Returns: The extracted component as a number.
- Example:
EXTRACT(YEAR FROM SYSDATE)
returns the current year. - Notes: Useful for date comparisons and analytics.
- Use Case: Analyzing sales data by month or year.
Leave a Reply