Forum

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

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

2 Posts
1 Users
0 Likes
312 Views
kumar BI
Posts: 12
 kumar BI
Guest
Topic starter
(@kumar BI)
Active Member
Joined: 2 years ago

SQL Case Statement use

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

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: