A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 孔健 中级黑马   /  2013-3-9 13:26  /  1923 人查看  /  3 人回复  /   1 人收藏 转载请遵从CC协议 禁止商业使用本文

1、新建表create table
create table Person3(Number varchar(20),Age int)
2、数据插入insert into
insert into Person3(number,name) values('IT001','小明')
3、数据更新(修改)update set
update Person3 set age=30
4、数据检索select
select * from Person3
select number as 编号,NAME as 姓名,Salary+10000 as 月薪from Person3;-- as 用来给列名起别名
5、聚合函数
count()、max()、min()、avg()、sum()
6、数据排序order by
select * from Person3
where age>25 and age<=30
order by age ASC;  --注:order by 子句要放在where 子句之后
7通配符过滤'_', '%'
select * from Person3 where name like'_erry'  --检索以任意字符开,剩余部分为"erry"的数据
select * from Person3 where name like'%n%' --检索name中包含字n
8空值处理isnull/ is not null
select * from Person3
where name is not null --is not null 判断name不为null的数据
9多值匹配 in
select * from Person3
where age in(27,28,35)  --age 为27或28或35的
10数据分组group by
select age,avg(salary) from Person3
group by age   --根据age进行分组
11Having子句
select age,count(*)as 人数from person3
group by age
having count(*)>1 --having必须放在group by之后having只能对分组后的数据进行过滤

评分

参与人数 1技术分 +1 收起 理由
张文 + 1

查看全部评分

3 个回复

倒序浏览
值得学习ing!
回复 使用道具 举报
{:soso_e142:}
回复 使用道具 举报
了解一下,有备无患!
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马