Search the Blog

Monday, July 15, 2019

SQL CASE Statement Syntax and Query

Case statement have three parts
 1 Condtion
 2 If condition True
 3 If condition False

 Top 100+ Sql Server Interview Questions




SYNTAX-
    SELECT  CASE WHEN Conditon  Then Value1 else Value2 from table_name

QUERY
 SELECT STUDENT_NAME, CASE WHEN STUDENT_ADD=1 THEN PERMANENT_ADDRESS ELSE TEMPORARY ADDRESS FROM STUDENT_MASTER
SQL CASE Statement Syntax and Query

No comments:

Post a Comment

Translate