-- your code goes herecreate table test (id number(3) not null);
create table product_category (
id number(20) not null,
name varchar2(80) not null,
CONSTRAINT product_category_pk PRIMARY KEY (id)
);
create table product (
id number(20) not null,
name varchar2(80) not null,
price number(7, 2) not null,
cat_id number(2) not null,
CONSTRAINT product_pk PRIMARY KEY (id),
CONSTRAINT fk_product_category FOREIGN KEY (cat_id) REFERENCES product_category(id)
);
insert into product_category (id, name) values (1, 'Food');
insert into product_category (id, name) values (2, 'Building');
insert into product_category (id, name) values (3, 'Cars');
insert into product (id, name, price, cat_id) values (01, 'Coffee', 0.95, 1);
insert into product (id, name, price, cat_id) values (02, 'Bread', 0.30, 1);
insert into product (id, name, price, cat_id) values (03, 'Salt', 0.15, 1);
insert into product (id, name, price, cat_id) values (04, 'Red_Brick', 22.30, 2);
insert into product (id, name, price, cat_id) values (05, 'White_Brick', 22.10, 2);
insert into product (id, name, price, cat_id) values (06, 'Half_Red_Brick', 11.15, 2);
insert into product (id, name, price, cat_id) values (07, 'Half_White_Brick', 11.05, 2);
insert into product (id, name, price, cat_id) values (08, 'Slow_Car', 3000.90, 3);
insert into product (id, name, price, cat_id) values (09, 'Middle_Car', 4500.30, 3);
insert into product (id, name, price, cat_id) values (10, 'Fast_Car', 6000.80, 3);
/* Даны таблицы:
product_category - категории продуктов:
id - номер категории;
name - имя категории;
product - каталог продуктов и цен:
id - номер продукта;
name - имя продукта;
price - цена;
cat_id - номер категории;
Задание:
Написать запрос для вывода списка продуктов, которые имеют цену > 10.00.
Условия:
- Цена продукта > 10;
- Вывести только поля: id, name, price
- Отсортировать по возрастанию цены;
*/
select Pepper from product;
insert into product(Id,Name,price,CAT_ID)values('50','Pepper','0.3','1');
commit;
select * from product_category;
LS0geW91ciBjb2RlIGdvZXMgaGVyZWNyZWF0ZSB0YWJsZSB0ZXN0IChpZCBudW1iZXIoMykgbm90IG51bGwpOwoKY3JlYXRlIHRhYmxlIHByb2R1Y3RfY2F0ZWdvcnkgKAogICBpZCBudW1iZXIoMjApIG5vdC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