563 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Practise SQL in your browser with SQL Fiddle
Part eight of a sixteen-part series of blogs
Some of our poor delegates don't have the luxury of a home computer to install SQL on (even worse some have made bad life choices and picked a Mac). The good news is that you can still practise your SQL skills in your web browser, using the impressive SQL Fiddle site. Have no fear, SQL Fiddle is here, a browser based sandbox to bring you cheer!
There are two ways to test conditions in SQL: the IIF function or the CASE keyword. Let's try both! Start by using the IIF function to classify purchases (somewhat arbitrarily) by the quantity bought:
Using IIF, classify each product under 6 as Poor and anything else as Good. This query shows the first 3 of 80 rows.
This is fine, but I'd like to be more discerning with my categorisation. Depending on someone's performance they will receive a bonus. Use the CASE WHEN keyword to determine this:
Any purchase below 4 quantity will get 0% of the price as a bonus; between 4 and 8 they will get 10% of the price; anything else gets 15%.
Remember WHEN using a CASE and something is true, THEN something else should happen before the END.
Check out the answer here.
|Parts of this blog|
25 Aytoun Street