Oracle查询

1.普通查询
select * from 表格 查询所有内容
select 列名,列名 from 表格查询某几列

2.条件查询
select * from 表格 where 条件 条件查询

select * from 表格 where 条件1 and 条件2  条件之间并的关系

select * from 表格 where 条件1 and 条件2  条件之间或者的关系


3.模糊查询
select * from 表格 where 列名 like '字段%' 查询以中开头的
select * from 表格 where 列名 like '%字段%' 查询包含城的信息
select * from 表格 where 列名 like '_字段%' 查询城在第二个位置出现的数据

4.排序查询
select * from 表格 order by 列名 desc降序 asc 升序
select * from 表格 order by Brand,Powers 按照两个列排序

5.统计查询(聚合函数)
select count(列名) from 表格 查询总条数
select max(列名) from 表格 查询最大值
select min(列名) from 表格 查询最小值
select avg(列名) from 表格 查询平均值
select sum(列名) from 表格 查询总和

6.分组查询
select count(*) from 表格 group by 列名 根据系列分组查看每组的数据条数
select * from 表格 group by 列名 having count(*) >2 查询分组之后数据条数大于2的

7.去重查询
select distinct 列名 from 表格

原文地址:https://www.cnblogs.com/ermeng/p/6187461.html