Saturday 3 February 2018

The Case Statement

The code:


For once I have started with the code. So a case statement is basically a way to do an if the data says this then do that, if it does then that do that, else do this. The key things to note are that it will always output the first when criteria that it matches, so be careful with your criteria. The second thing is that if you leave out the else and it doesn't fall into anything then it will put NULL.

Case statement are very useful and I have used it a lot. Below is a snapshot of some of the results from the SQL script above.


No comments:

Post a Comment