From e3ddb8f5b22a6bf4af9aadacfe6b105c3ada7281 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 18 Jan 2026 14:30:51 +0300 Subject: [PATCH] filtration homework --- aharlamcev/postgresql/Filtrationhomework.sql | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 aharlamcev/postgresql/Filtrationhomework.sql 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