MYSQL的一些表操作语句练习

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;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值