DML语言详细梳理--select
来源:互联网 发布:淘宝不能卖香烟 编辑:程序博客网 时间:2024/06/04 20:08
查询语句
--union
select * from sunny union all select * from deptno; --无法执行。
select stid,name from sunny union select stid,name from sunny2;
select stid,name from sunny union all select stid,name from sunny2;
--between and
select * from sunny where grade between 50 and 75;
select * from sunny where age between 18 and 26;
select * from sunny where age not between 18 and 20;
--in
select * from sunny where grade in ('73','59','88');
select * from sunny where grade ='73' or grade ='59' or grade ='88';
select * from sunny where grade not in ('73','59','88');
--\通配符
select * from sunny where name like 'Joke\_sun' escape '\';
--is null
select * from sunny where age is null;
select * from sunny where age is not null;
--order by desc asc
--distinct 去重
select count(distinct age) from sunny;
select count(age) from sunny;
--count(),avg(),sum(),max(),min()
select count(*),max(age),min(age),avg(grade),sum(grade),max(grade),min(grade) from sunny;
--求分数大于平均分数的人的信息
select * from sunny where grade > (select avg(grade) from sunny );
select * from sunny where grade > avg(grade); --无法执行
--求分数最高的人的信息
select * from sunny where grade = (select max(grade) from sunny );
--求分数最低的人的信息
select * from sunny where grade = (select min(grade) from sunny );
-- 连接字符串
select stid ||' grade is '|| grade from sunny;
--使用列的别名
select age as "年龄" ,grade, grade*10 "年总分" from sunny;
--连接字符串(||)
SELECT stid || ' grade is ' || grade ||' 哈~ '|| name FROM sunny;
--like
select * from sunny where name like 's%';
--or
select * from sunny where name ='Manny' or grade >70;
- DML语言详细梳理--select
- DML语言详细梳理
- Oracle数据库知识梳理---续(DML语言)
- DDL语言详细梳理
- Go语言 Select 详细解读
- SQL---DML---SELECT语句总结
- SQL ----DML,DDL,SELECT DISTINCT
- sql语言之DML
- SQL语言 - DML篇
- 数据库操纵语言DML
- 数据库操纵语言DML
- 数据管理语言(DML)
- DML 数据操纵语言
- Sql入门-------DML语言
- 测试DML语言
- 数据库操纵语言DML
- DML数据操纵语言
- DML-数据操作语言
- DataTable的详细用法
- crontab(二),Cron服务
- 由12306.cn谈谈网站性能技术
- 关于jquery ui dialog 在IE下定位失效的解决办法
- input标签的tabindex属性
- DML语言详细梳理--select
- NGINX conf 配置文件中的变量大全 可用变量列表及说明
- 如何把别人的作品转化为自己的能力(第一篇)(版式篇)
- 安装rlwrap-0.37.tar.gz
- JavaScript世界的一等公民 - 函数
- HTTPS(SSL加密)webservice客户端访问总结
- iOS5编程--UIApplication深入研究
- 图片垂直居中的使用技巧
- ArcGIS制图技巧(上篇)