码迷,mamicode.com
首页 > 其他好文 > 详细

增删改查(不完全)

时间:2017-10-25 00:35:22      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:date   别名   完全   group   nbsp   insert   问题   distinct   esc   

 --增加
insert into Student values (‘108‘,‘曾华‘,‘男‘,‘1997-09-01‘,‘95033‘)
insert into Student(class,Sbirthday,ssex,sname,son)values
(‘95033‘,‘1975-10-02‘,‘男‘,‘匡明‘,‘105‘)
--删

 --delete from Student 全部删除
  delete from Student where Ssex = ‘null‘
--改
update Student set Sbirthday=‘1977-09-01‘where Son=‘108‘

--查
select * from  Teacher
select * from  Student where Sname=‘匡明‘
select * from  Student where Sbirthday > ‘1975-01-01‘
--模糊查询
select * from Student where Sname like ‘%王%‘
--排序查询
select * from Student order by class ,Son desc
--去重查询
select distinct class from Student
--分组查询
select class,COUNT(*) from Student group by Class
 
select Decree,AVG(*) from Score group by Decree  问题

--子查询
select * from Student where Class in (‘95033‘,‘95031‘)

select * from Score where Decree between 70 and 90


--别名
select sno as 学号
,Con as 班级
,decree from Score

增删改查(不完全)

标签:date   别名   完全   group   nbsp   insert   问题   distinct   esc   

原文地址:http://www.cnblogs.com/buzhiheyan/p/7726357.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!