# CREATE TABLE Cust ( # id_cust int auto_increment primary key, # id_country int, # age int, # join_date datetime, # _balance decimal(8,2), # ); # CREATE TABLE SelectedGoods ( # id_sg int auto_increment primary key, # id_cust int, # id_goods int, # ); # CREATE TABLE Goods ( # id_goods int auto_increment primary key, # goods varchar(255) not null, # cost decimal(8,2) not null, # ); # CREATE TABLE Country ( # id_country int auto_increment primary key, # country varchar(255) not null, # ); # SELECT # Cust.id_cust, Cust.id_country, Cust.age, # Cust.join_date, Cust._balance, # SelectedGoods.id_sg, SelectedGoods.id_cust, # SelectedGoods.id_goods, # Goods.goods, Goods.cost, # Country.country # FROM # Cust # INNER JOIN SelectedGoods ON (Cust.id_cust = SelectedGoods.id_cust) # INNER JOIN Goods ON (SelectedGoods.id_goods = Goods.id_goods) # INNER JOIN Country ON (Cust.id_country = Country.id_country) # WHERE # Country.country = 'Ukraine' AND # Cust.age >= 25 AND # Cust.join_date >= DATE_ADD(NOW(), INTERVAL -1 DAY) AND # Cust._balance > 5.50 AND # Goods.goods IN ('Monitor LG','CDROM 52x') # ORDER BY # Cust._balance DESC, # Cust.age ASC ; %Q = ( country => 'Ukraine', age__ge => 25, join_date__date_ge => "-1 DAY", _balance__gt => 5.50, goods => ["Monitor LG", "CDROM 52x"], -order => ["_balance DESC", "age"], ); @search_result = $dbh->Select(["Customer", "SelectedGoods", "Goods", "Country"], \%Q);