USE tpch1; select count(*) from region group by r_name having r_name regexp '.*A.*'; count(*) 1 1 1 1 select count(*) from region group by r_name, r_regionkey having r_name regexp '.*A.*' and r_name regexp '.*'; count(*) 1 1 1 1 select count(*) from region group by r_name, r_regionkey having r_name regexp '.*A.*' and r_regionkey > 2; count(*) 1 select r_name from region where r_name regexp ".*S.*" group by r_name having r_name regexp ".*S.*" order by 1; r_name ASIA MIDDLE EAST select * from region where r_regionkey not in (select n_regionkey from nation group by n_regionkey having n_regionkey>3 and n_regionkey < 10) order by 1; r_regionkey r_name r_comment 0 AFRICA lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 1 AMERICA hs use ironic, even requests. s 2 ASIA ges. thinly even pinto beans ca 3 EUROPE ly final courts cajole furiously final excuse