sql指令,增,删,查,改

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

sql指令,增,删,查,改

小破的前端理想   2021-04-28 我要评论

 

insert into table (name,sex,age) value('张三',‘男’,‘20’)   向表中的name,sex,age,分别添加张三,男,20的内容

select   “要查找的东西” from  "从哪一个表查"        *代表所有

select    name where table where name='肖淇'   在表中查询名字为肖淇的内容

delete   from table   where name='肖淇'  在表中删除名字为肖淇的内容

delete  from table 删除整个表中的内容

update   table name='张三' where name='肖淇'    将表中名字为肖淇的内容改为张三

 

 

拓展:

排序

select * from table order by age   查询表中所有信息,并按年级升序排序

select * from table order by age  desc  查询表中所有信息,并按年级降序排序

 

返回唯一不同的值

 select  distinct age from table   查询表中不同的年龄有那些

 

and ,or

select * from table where sex='男' and age>20 查询表中性别为男并且年龄大于20的列

select * from table where sex='女' or age>20 查询表中性别为女或者年龄大于20的列

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们