YEAR_MONTH serves two closely related purposes in SQL.1. Interval qualifier – In interval literals and arithmetic, YEAR_MONTH tells the database that the literal contains both year and month fields. For example, INTERVAL '1-3' YEAR_MONTH represents one year and three months.2. Date-part specifier – In functions such as EXTRACT or DATE_TRUNC, YEAR_MONTH designates that the resulting numeric value should include the four-digit year followed by the two-digit month (YYYYMM).Support originates from the SQL-92 standard, and most enterprise-grade systems have implemented it. Behaviour is consistent: arithmetic involving YEAR_MONTH adjusts the year first and then the month, while EXTRACT(YEAR_MONTH FROM dt) returns an integer without separators (e.g., 202405). Caveats: some engines require a string literal, others allow ISO8601 style (e.g., INTERVAL 'P1Y2M'). Not all drivers can bind YEAR_MONTH intervals, so client-side formatting may be necessary.
SQL-92 (core), first implemented widely in Oracle8i and MySQL 4.0
Use a single quoted string with a hyphen between the year and month parts, for example '2-4' for two years and four months.
Yes. Many schemas store it as an INTEGER (e.g., 202405) or CHAR(6). Use CHECK constraints or generated columns to keep values valid.
Leap-year logic is irrelevant because the interval contains only year and month precision. Day alignment occurs after the month shift is applied.
Recent SQLite builds include limited support, but older versions require manual math using STRFTIME or substrings.