Something different for today — a multiple choice CodeSOD! Assume the following:

(CASE WHEN "Help Desk Attributes".Priority = '3-Medium' AND ("Help Desk Attributes"."TAT To Close - Days" - (Case WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" = 0 THEN 0 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" <= 5 THEN 1 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" = 6 THEN 2 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" <= 12 THEN 3 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" = 13 THEN 4 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" <= 19 THEN 5 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 4 THEN 0 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" = 5 THEN 1 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" <= 11 THEN 2 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" = 12 THEN 3 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" <= 18 THEN 4 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 3 THEN 0 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" = 4 THEN 1 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" <= 10 THEN 2 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" = 11 THEN 3 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" <= 17 THEN 4 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 2 THEN 0 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" = 3 THEN 1 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" <= 9 THEN 2 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" = 10 THEN 3 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" <= 16 THEN 4 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 1 THEN 0 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" = 2 THEN 1 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" <= 8 THEN 2 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" = 9 THEN 3 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" <= 15 THEN 4 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 0 THEN 0 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" = 1 THEN 1 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" <= 7 THEN 2 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" = 8 THEN 3 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" <= 14 THEN 4 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 0 THEN 0 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" = 1 THEN 1 WHEN "- Open Date"."Day in Week" <= 7 AND "Help Desk Attributes"."TAT To Close - Days" <= 76 THEN 2 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" = 7 THEN 3 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" <= 13 THEN 4 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" = 14 THEN 5 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" <= 20 THEN 6 ELSE 0 END)) <= 5 THEN 1 WHEN "Help Desk Attributes".Priority = '4-Low' AND ("Help Desk Attributes"."TAT To Close - Days" - (Case WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" = 0 THEN 0 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" <= 5 THEN 1 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" = 6 THEN 2 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" <= 12 THEN 3 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" = 13 THEN 4 WHEN "- Open Date"."Day in Week" = 1 AND "Help Desk Attributes"."TAT To Close - Days" <= 19 THEN 5 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 4 THEN 0 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" = 5 THEN 1 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" <= 11 THEN 2 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" = 12 THEN 3 WHEN "- Open Date"."Day in Week" = 2 AND "Help Desk Attributes"."TAT To Close - Days" <= 18 THEN 4 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 3 THEN 0 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" = 4 THEN 1 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" <= 10 THEN 2 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" = 11 THEN 3 WHEN "- Open Date"."Day in Week" = 3 AND "Help Desk Attributes"."TAT To Close - Days" <= 17 THEN 4 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 2 THEN 0 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" = 3 THEN 1 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" <= 9 THEN 2 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" = 10 THEN 3 WHEN "- Open Date"."Day in Week" = 4 AND "Help Desk Attributes"."TAT To Close - Days" <= 16 THEN 4 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 1 THEN 0 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" = 2 THEN 1 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" <= 8 THEN 2 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" = 9 THEN 3 WHEN "- Open Date"."Day in Week" = 5 AND "Help Desk Attributes"."TAT To Close - Days" <= 15 THEN 4 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 0 THEN 0 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" = 1 THEN 1 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" <= 7 THEN 2 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" = 8 THEN 3 WHEN "- Open Date"."Day in Week" = 6 AND "Help Desk Attributes"."TAT To Close - Days" <= 14 THEN 4 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" BETWEEN -1 AND 0 THEN 0 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" = 1 THEN 1 WHEN "- Open Date"."Day in Week" <= 7 AND "Help Desk Attributes"."TAT To Close - Days" <= 76 THEN 2 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" = 7 THEN 3 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" <= 13 THEN 4 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" = 14 THEN 5 WHEN "- Open Date"."Day in Week" = 7 AND "Help Desk Attributes"."TAT To Close - Days" <= 20 THEN 6 ELSE 0 END)) <= 10 THEN 1 ELSE 0 END)

Evaluate the above SQL code. What does it do? (cirle the appropriate answer(s) on your monitor with a number two pencil)

  1. Count the number of open Help Desk tickets
  2. Create an in-memory table that can be JOINed against later
  3. Give Michael L. migraines
  4. Counts off business days between two dates
  5. Make you want to commit suicide

Pencils down!

The correct answer is D. (C and E are also acceptable.)