Wanna learn If-Else?

Written on May 05, 2016

When it comes to decision making, there are always conditions on which decisions are formed. In other-words there are If-Else. From Assembly languages to modern languages, it-else is and was very common part of them. In real life also there are if-else when it comes to decision making, if we take example of mind set of employee when it comes to getting raise. He thinks, "if I got good raise this year, I'll stick to same company, else I'll try to negotiate with management. If my negotiation succeed, I'll stick to same company, else I'll join another company". :)

No how to do this SQL Way. First of all let's see the syntax.

Here, we don't need to specify BEGIN-END block when we have only single statement. But it's good practice to have BEGIN-END block. If we want to indicate above example in SQL, we can write below query.


By the way, in my case output is 'My Company is awesome!!'.