YEAR_MONTH
Example
Section titled “Example”SELECT EXTRACT(YEAR_MONTH FROM '2021-05-27 01:23:45') as ExtractedYearMonth;Output
Section titled “Output”+-------------------+| ExtractedYearMonth|+-------------------+| 202105|+-------------------+Explanation
Section titled “Explanation”The EXTRACT function with YEAR_MONTH is used to retrieve the year and month as a decimal format (YYYYMM) from a specified date. Here, ‘2021-05-27 01:23:45’ was provided as the date, which returned ‘202105’ as the output.