信息更新

 

练习:1、向biao2插入以下信息

     插入:1、‘张三’,‘1997-2-3’,6000

           2、‘李四’,‘男’,‘1998-3-5’,4000

           3、‘王五’,‘女’,‘1998-4-6’,7000,”软件开发”

    Insert into biao2 set name=’张三’,birthday=’1997-2-3’,salary=6000;

    Insert into biao2 set name=’李四’,birthday=’1998-3-5’,salary=4000, genter=’1’;

Insert into biao2 set name=’王五’,birthday=’1998-4-6’,salary=7000,resume=’软件开发’,genter=’0’;

 

 

练习2

将所有员工的工资增加1000

Update biao2 set salary=salary+1000;

将李四的工资改为5000

update biao2 set salary=5000 where name=’张三’;

给张三增加100

Update biao2 set salary=salary+100 where name=’张三’;

 

 

练习3:删除所有男员工

Delete from biao2 where genter=’1’;

      删除表中所有数据

Delete from biao2;

 

练习4:

查询年龄大于10岁的员工信息,用年“龄”当别名

Select * from biao2 where now()-birthday>10;

 

练习5:

create table student(

  id int(10) not null auto_increment,

CHI int(10),

  ENG int(10),

   name varchar(10) not null,

  primary key(id)

);

 

mysql> Insert into student values('',80,97,'zhjk');

Query OK, 1 row affected, 1 warning (0.00 sec)

 

mysql> Insert into student values('',60,78,'zhjyk');

Query OK, 1 row affected, 1 warning (0.00 sec)

 

mysql> Insert into student values('',78,67,'dkdhk');

Query OK, 1 row affected, 1 warning (0.00 sec)

 

 

查询英语分数在80-90之间的

Select * from student where ENG between 80 and 90;

查询语文味81,82,83,84的学生

Select * from student where CHI in(81,82,83,84);

查询姓张的学生信息

Select * from student where name like”z%”;

查询不姓张的学生的总成绩

select *,(CHI+ENG) from student where name not like"z%";

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值