Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
547 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers 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
Search our website
We also send out useful tips in a monthly email newsletter ...
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.
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.