diff --git a/aharlamcev/postgresql/WindowFunctionHomework.sql b/aharlamcev/postgresql/WindowFunctionHomework.sql index 72dd993..bd81ac9 100644 --- a/aharlamcev/postgresql/WindowFunctionHomework.sql +++ b/aharlamcev/postgresql/WindowFunctionHomework.sql @@ -19,12 +19,15 @@ values (1, 'iPhone 14', 'smartphone', 799, true, 'iphone@apple.com'), (9, 'Honor Pad X9', 'tablet', 219, true, 'honor@support.com'), (10, 'Dell XPS 13', 'laptop', 1099, false, 'dell@support.com'); +alter table products_extended +alter column price type DECIMAL(10, 2) + select * from products_extended with email_false as (select * from ( select category, name, price, email_support, row_number() over (partition by category order by price desc) as rn -from products_extended where email_support is null) +from products_extended where email_support is null) where rn = 1 ), email_true as (select * from