SQL query with multiple executed from multiple conditions

Question:

You are given a table with 10 numeric fields, and 8 conditions like Field_1 <0, Field_4> Field_2, Field_5 <115, etc. How can I query all records in a table that satisfy at least 4 of any of the 8 conditions?

Answer:

SELECT * FROM tbl
WHERE
  (CASE WHEN Field_1 < 0 THEN 1 ELSE 0) + 
  (CASE WHEN Field_4 > Field_2 THEN 1 ELSE 0) + 
  (CASE WHEN Firld_5 < 115 THEN 1 ELSE 0) + 
  (CASE WHEN Firld_3 < 0 THEN 1 ELSE 0) + 
  (CASE WHEN Firld_5 < 0 THEN 1 ELSE 0) + 
  (CASE WHEN Firld_6 < 0 THEN 1 ELSE 0) + 
  (CASE WHEN Firld_7 < 0 THEN 1 ELSE 0) + 
  (CASE WHEN Firld_8 < 0 THEN 1 ELSE 0)
  >= 4
Scroll to Top