Home > database >  SQL select application problems
SQL select application problems

Time:10-19

Drop table product;
The CREATE TABLE PRODUCT (
Product_id varchar (6)
, product_name varchar (12)
, in_price integer
, out_price integer
, start_day timestamp
The primary key (product_id, start_day)
);
COMMENT ON the TABLE the product IS 'goods';
COMMENT ON the COLUMN product. Product_id IS 'goods コ ー ド';
COMMENT ON the COLUMN product. Product_name IS 'brand name';
COMMENT ON the COLUMN product. In_price IS 'buy 価 lattice;
COMMENT ON the COLUMN product. Out_price IS 'vendor 売 価 lattice';
COMMENT ON the COLUMN product. Start_day IS 'vendor 売 days';


INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10001 ', 'millet mobile phone', '2100', 3666, to_date (' 20190101 ', 'yyyymmdd'));
INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10001 ', 'millet mobile phone', '2000', 3666, to_date (' 20190201 ', 'yyyymmdd'));
INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10001 ', 'millet mobile phone', '1988', 3666, to_date (' 20190401 ', 'yyyymmdd'));
INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10002 ', 'beauty', '6100', 8666, to_date (' 20190301 ', 'yyyymmdd'));
INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10002 ', 'beauty', '6300', 8666, to_date (' 20190315 ', 'yyyymmdd'));
INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10002 ', 'beauty', '5900', 8666, to_date (' 20190401 ', 'yyyymmdd'));
INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10003 ', 'washing machine', '1980', 3666, to_date (' 20190423 ', 'yyyymmdd'));
INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10003 ', 'washing machine', '1790', 3666, to_date (' 20190503 ', 'yyyymmdd'));
INSERT INTO the PRODUCT (product_id, product_name, in_price out_price, start_day)
VALUES (' 10003 ', 'washing machine', '2000', 3666, to_date (' 20190623 ', 'yyyymmdd'));

The way how to use the select write commodity code, name of commodity, purchase quantity, and buy the total price,
A great god, please guide the younger brother a thing or two,
  • Related