--注释:table_name为表名
--查询某个字段
select a.id from table_name a;
--查询某个字段或者几个字段
select a.id,a.code,a.address from table_name a;
--查询唯一、不重复的值 用distinct
select distinct a.address from table_name a;
--依据条件查询
select * from table_name a where a.code='0331816900';
--依据多个条件查询 用and连接
select * from table_name a where a.code='0331816900' and a.is_valid=1;
--依据其中一个条件 用or连接
select * from table_name a where a.code='0331816900' or a.is_valid=1;
--依据某个字段升序排序查询
select * from table_name order by code;
--依据某个字段降序排序查询
select * from table_name order by code desc;
--查询某个字段不为空
select * from table_name a where a.is_valid is not null;
--查询某个字段为空
select * from table_name a where a.is_valid is null;
--模糊查询 '春%'查询‘春’字开头的 '%春%'查询包含所有的
select * from table_name a where a.address like '%春%';
--依据某个字段的特定值查询
select * from table_name a where a.address in ('五龙家园二期38-1-501','泰兴镇泰兴里2-1-201');
--依据字段之间所有的值
select * from table_name a where a.code between 0331816900 and 0551482600;
这是在Oracle中常见的查询,如有不对欢迎批评指正。