One Query for all 4 conditions

Viewed 33

A dataset with order_no, device_type and discount as columns in “Commercial” table: No. Of orders with—

  1. Device type Desktop and discount<2
  2. Device type Desktop and discount 2-3.5
  3. Device type Android and discount>3.5
  4. Column names others with number of orders that dont satisfy any of the three conditions
1 Answers
Select *
from  commercial
where (device_type== 'desktop' and discount 《2) or (device_type =='desktop' and (discount 》=2 or discount 《=2));

Similarly you can make multiple condition.

Read below

Related