Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Explain the purpose of the SQL CASE statement.
Answer: The CASE statement is used to perform conditional logic within a SQL query, similar to an IF-THEN-ELSE statement in other programming languages.

Example:

SELECT column1, CASE WHEN condition THEN 'Result1' ELSE 'Result2' END AS NewColumn FROM table;
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook