当前位置:   article > 正文

mysql之增删改查语句_mysql增删改查语句

mysql增删改查语句
一、SQL语句之增
insert into 表名 values (1,....)
向student表中插入一个学生的数据

insert into student (num,name,sex,age)
values(140010,张三,,23)

二、SQL语句之删
delete from 表名称 where 列名称 = 值

删除student表中num=140011的这条数据。
delete from student where num=140011;

三、SQL语句之改

update 表名称 set 列名称 = 新值 where 列名称 = 某值

我们可以将num为140010的age值更改为21update student set age =21 where num=140010;

四、SQL语句之查
select 列名称 from 表名称

//以及:

select * from 表名称

查询语句非常的重要的,所以需要详细来说一下。

1、查询student表中所有数据
select * from student;

2、查询student表中所有的name和sex
select name,sex from student;

3、查询num为140010这一行的数据
select * from where num =140010;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/1008955
推荐阅读
相关标签
  

闽ICP备14008679号