diff --git a/aharlamcev/postgresql/Filtrationhomework.sql b/aharlamcev/postgresql/Filtrationhomework.sql new file mode 100644 index 0000000..b8d9407 --- /dev/null +++ b/aharlamcev/postgresql/Filtrationhomework.sql @@ -0,0 +1,22 @@ +select * from products + +select name, category, price, price * 1.3 as price_with_markup, price * 1.5 as price_with_vat +from products +where in_stock is true and category != 'smartwatch' and price between 100 and 1300; + +select name, price, price * 0.85 as price_with_discount +from products +where price < 100 or price > 1000; + +select id, name, category, price from products +where category in ('tablet', 'smartphone', 'mouse') and price > 100; + +select name, category, price from products +where name not ilike '%iphone%'; + +select name, category, price from products +where name ilike '%pro%'; + +select name, category, price from products +where name ilike '%mx%' +order by price desc; \ No newline at end of file