Skip to content
Question

Q.What will be the output of the following SQL command? SELECT MONTHNAME('2024-08-02'); (A) 08 (B) 02 (C) February (D) August

CBSECBSE Class XII Board 2025MCQ· 1mImportance★★★★★
✓ Free question

The SQL function MONTHNAME() returns the full name of the month from a given date, so for '2024-08-02' the output is August.

The MONTHNAME() function is a date-related function in SQL that extracts just the month portion of a date and returns it as a complete English word — not a number, not an abbreviation. Think of it as the opposite of MONTH(), which gives you a numeric value like 8 for August. MONTHNAME() is designed for readability, especially when generating reports or labels where "August" is far clearer than "08".

In the command SELECT MONTHNAME('2024-08-02');, the date string '2024-08-02' is in the standard YYYY-MM-DD format. SQL parses this as the 2nd of August, 2024. The function then looks only at the month component — 08 — and returns its corresponding full name.

Note

The MONTHNAME() function is case-insensitive in most SQL implementations, but the output is typically capitalised (e.g., August, not august). This is consistent with how MySQL and other major databases handle it.

Now, let's examine the options given:

  • (A) 08 — This would be the output of MONTH(), not MONTHNAME(). A common confusion, but incorrect here.
  • (B) 02 — This is the day part of the date, not the month. The function DAY() or DAYOFMONTH() would return this.
  • (C) February — This is the name for month 02, but our date is 08 (August), not February. A trap for those who misread the date.
  • (D) August — Correct. The month 08 corresponds to August, and MONTHNAME() returns the full name.
Important

Always remember: MONTHNAME() returns the full month name (e.g., January, February, March), never a number or an abbreviation. If you need the month number, use MONTH() instead.

✓Final answer

The output of SELECT MONTHNAME('2024-08-02'); is August, which corresponds to option (D).

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.