Case statement have three parts
1 Condtion
2 If condition True
3 If condition False
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
No comments:
Post a Comment