1、思考过程
应有字段:本账户id、本账户姓名、交易金额、交易标识(0为正,1为负)、对方账户id、对方账户姓名、交易编号、交易摘要(例如产品名称和交易平台)、余额、交易时间、备注。共计11个字段。
2、建表语句
create table bill2( user_id int not null comment '本账户id', user_name varchar(255) not null comment '本账户姓名', amount double(10,2) not null comment '交易金额', identification int not null comment '交易标识', opposite_id int not null comment '对方账户id', opposite_name varchar(255) not null comment '对方账户姓名', number int not null comment '交易编号', abstract varchar(255) not null comment '交易摘要', money double(10,2) not null comment '余额', date datetime not null comment '交易时间', remarks varchar(255) comment '备注', primary key(user_id) );
3、结构展示
4、插入数据
insert into bill(user_id,user_name,amount,identification,opposite_id,opposite_name,number,abstract,money,date,remarks) values (622820977,"黄*敏",85.90,1,215520060,"李*",12301,"外卖,美团",999.90,"2022-04-18 21:42:04","好好吃饭"),(722820977,"张*",66.90,1,322669870,"王*",12302,"购物,支付宝",933.00,"2022-04-18 21:52:24","买点生活用品");
5、效果展示
6、查询操作
select amount,identification,opposite_id,opposite_name,money,date from bill where user_id=622820977;
7、删除操作
delete from bill where user_id=622820977;