SQL EXTRACT Function: Usage Guide
In SQL, the EXTRACT function is used to extract specific parts of a date or time, such as the year, month, day, etc. Its syntax is as follows:
EXTRACT(field FROM source)
In this case, the field is the part to be extracted, which can be YEAR, MONTH, DAY, etc.; the source is the date or time value to be extracted.
For example, to extract the year value from a date, you can use the following statement:
SELECT EXTRACT(YEAR FROM '2022-09-15');
This will result in returning 2022.