Forum

What is the SQL CAS...
 
Share:
Notifications
Clear all

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


Posts: 12
Guest
Topic starter
(@kumar BI)
Active Member
Joined: 4 years ago

SQL Case Statement use

1 Reply
Posts: 47
Guest
(@Ram DBA)
Eminent Member
Joined: 4 years 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

Self Learning Video Tutorials - Software Course

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: