50 lines
1.9 KiB
SQL
50 lines
1.9 KiB
SQL
select distinct(i_product_name)
|
|
from item i1
|
|
where i_manufact_id between 748 and 748+40
|
|
and (select count(*) as item_cnt
|
|
from item
|
|
where (i_manufact = i1.i_manufact and
|
|
((i_category = 'Women' and
|
|
(i_color = 'gainsboro' or i_color = 'aquamarine') and
|
|
(i_units = 'Ounce' or i_units = 'Dozen') and
|
|
(i_size = 'medium' or i_size = 'economy')
|
|
) or
|
|
(i_category = 'Women' and
|
|
(i_color = 'chiffon' or i_color = 'violet') and
|
|
(i_units = 'Ton' or i_units = 'Pound') and
|
|
(i_size = 'extra large' or i_size = 'small')
|
|
) or
|
|
(i_category = 'Men' and
|
|
(i_color = 'chartreuse' or i_color = 'blue') and
|
|
(i_units = 'Each' or i_units = 'Oz') and
|
|
(i_size = 'N/A' or i_size = 'large')
|
|
) or
|
|
(i_category = 'Men' and
|
|
(i_color = 'tan' or i_color = 'dodger') and
|
|
(i_units = 'Bunch' or i_units = 'Tsp') and
|
|
(i_size = 'medium' or i_size = 'economy')
|
|
))) or
|
|
(i_manufact = i1.i_manufact and
|
|
((i_category = 'Women' and
|
|
(i_color = 'blanched' or i_color = 'tomato') and
|
|
(i_units = 'Tbl' or i_units = 'Case') and
|
|
(i_size = 'medium' or i_size = 'economy')
|
|
) or
|
|
(i_category = 'Women' and
|
|
(i_color = 'almond' or i_color = 'lime') and
|
|
(i_units = 'Box' or i_units = 'Dram') and
|
|
(i_size = 'extra large' or i_size = 'small')
|
|
) or
|
|
(i_category = 'Men' and
|
|
(i_color = 'peru' or i_color = 'saddle') and
|
|
(i_units = 'Pallet' or i_units = 'Gram') and
|
|
(i_size = 'N/A' or i_size = 'large')
|
|
) or
|
|
(i_category = 'Men' and
|
|
(i_color = 'indian' or i_color = 'spring') and
|
|
(i_units = 'Unknown' or i_units = 'Carton') and
|
|
(i_size = 'medium' or i_size = 'economy')
|
|
)))) > 0
|
|
order by i_product_name
|
|
limit 100;
|