CREATE DATABASE account_receivable;
use account_receivable;
CREATE TABLE account_info(
uuid varchar(32) primary key,
pname varchar(32),
income float,
cost float,
sale_date date,
sale_num float,
sale_price float,
cost_price float
);
insert into account_info(
uuid,pname,income,cost,sale_date,
sale_num,sale_price,cost_price)
values('00002','产品b',1239.87,
208.24,20201020,80.67,19.3,2.71 );
SELECT*FROM account_info;
insert into account_info(
uuid,pname,income,cost,sale_date,
sale_num,sale_price,cost_price)
values('00001','产品a',1240.87,
209.24,20201020,82.67,19.3,2.71);
SELECT*FROM account_info;
insert into account_info()
values('00003','产品c',8893.27,7653.59,20201019,89.96,98.97,85.17),
('00004','产品D',1171.03, 686.7,20201011,71.33,16.42,8),
('00005','产品E',1428.47,6324.22,20201025,55.85,25.58,113.24),
('00006','产品F',9519.28,2345.25,20201029,45.16,208.72,51.42),
('00007','产品G',2288.56,2679.57,20201021,12.97,176.44,206.59),
('00008','产品H',8177.83,3062.68,20201023,68.82,118.82,44.5),
('00009','产品I',7920.36,3803.42,20201026,14.29,554.27,266.17),
('00010','产品J',6185.89,1040.76,20201001,41.86,144.32,24.28),
('00011','产品A',1630,281,20201027,100,16.3,2.81);
SELECT*FROM account_info;
SELECT*FROM account_info where income>1240;
SELECT pname,sale_num,sale_price,sale_date
from account_info where sale_date
between '2020-10-21' and '2020-10-26';
SELECT sale_date from account_info where '>2020-10-27';
SELECT pname,sale_date,cost_price from account_info where 'cost_price>2';
SELECT*FROM account_info where pname='产品A'and sale_date='2020-10-21';
update account_info set sale_price=20 where uuid='00001';
update account_info set sale_price=3 where pname='产品A' and sale_date='2020-10-01';
delete from account_info where pname='产品B';