This commit is contained in:
Alex
2026-02-16 11:05:00 +03:00
parent 4aa11c0136
commit 87ba57befe
+3 -1
View File
@@ -23,6 +23,7 @@ id INT primary key,
user_id INT, user_id INT,
order_date DATE not null, order_date DATE not null,
status VARCHAR(20) status VARCHAR(20)
FOREIGN KEY (user_id) REFERENCES users(id)
); );
create table order_items ( create table order_items (
@@ -31,6 +32,7 @@ product_id INT,
quantity INT not null, quantity INT not null,
price_at_purchase DECIMAL(10, 2) not null, price_at_purchase DECIMAL(10, 2) not null,
primary key (order_id, product_id) primary key (order_id, product_id)
FOREIGN KEY ()
); );
alter table users alter table users
@@ -276,7 +278,7 @@ order by domain, name;
-- 3 задание -- 3 задание
select name, age, select name, age,
case when age < 25 then 'young' case when age < 20 then 'young'
when age between 20 and 30 then 'adult' when age between 20 and 30 then 'adult'
else 'senior' else 'senior'
end as age_group end as age_group