Forum

What is the SQL CAS...
 
Notifications
Clear all

What is the SQL CASE statement used for? Explain with an example?


kumar BI
Posts: 12
 kumar BI
Topic starter
(@kumar BI)
Joined: 1 year ago

SQL Case Statement use

Topic Tags
1 Reply
Ram DBA
Posts: 47
 Ram DBA
(@Ram DBA)
Joined: 1 year ago

It allows you to embed an if-else like a clause in the SELECT clause.

Here is an example.

SELECT Employee_Name,CASE Location
WHEN ‘Joe’ THEN Bonus * 2
WHEN ‘Peter’ THEN Bonus *, 5
ELSE Bonus
END
“New Bonus”
FROM Employee;

Reply
Share: