编辑代码

CREATE DATABASE accounts_receivable;
use accounts_receivable;
create table accounts_info(
	uuid varchar(32),
	pname varchar(32),
	income float,
	cost float,
    sale_date date,
    sale_num float,
    sale_price float,
    cost_price float)
    ;

insert into accounts_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)
        ; 
insert into accounts_info()
        values(
            '00001',
            '产品A',
            1240.87,
            208.24,
            20201020,
            82.67,
            19.3,
            2.71)
            ;
select*from accounts_info;
insert into accounts_info()
values(
    '00003','产品C',8893.27,7653.59,20201019,89.96,98.97,85.17),
    ('00004','产品D',1171.03,686.67,20201011,71.33,16.42,0.00),
    ('00005','产品E',1428.47,6324.22,20201025,55.85,25.58,113.240),
    ('00006','产品F',9519.28,2345.25,20201029,45.61,208.72,51.42),
    ('00007','产品G',2288.56,2679.57,20201021,12.97,176.44,206.59),
    ('00008','产品H',8177.03,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.280),
    ('00011','产品A',1630,281,20201027,100,16.3,2.81);
select*from accounts_info;
select*from accounts_info where income>1240;
select pname,sale_num,sale_price,sale_date from accounts_info where sale_date between'2020-10-21'and'2020-10-26';
select*from accounts_info where sale_date> '20201027';
select pname,sale_date,cost_price from accounts_info where 'cost_price>2';
select*from accounts_info where pname='产品A' and sale_date='20201021';
update accounts_info set sale_price=20 where uuid='00001';
update accounts_info set sale_price=3 where sale_date='20201001' and pname='产品J'; 
delete from accounts_info where pname='产品B';
select*from accounts_info;