Oracle数据库的基本用法

用法实例:

 

--选取整个表的列
1.   select * from emp;
--选取指定列的内容
select job from emp;
select ename,sal from emp;
--条件判断 
select sal from emp
  where sal=800;
--between and 方法
select * from emp
  where  sal between 2000 and 3000;
--嵌套的使用
select job from 
  (select * from emp
     where  sal between 2000 and 3000);
--单列数据的改变     
select sal+25 from emp;
--用like(模糊)概念  (-一个字符) (% 0个或多个字符)
 select job from emp
   where job like '%LE%';
--从in()里面的数据选出   
 select * from emp
   where comm in(300,500);
select sal,sal+25.00 AS saly from emp;
--字符串的连接   AS别名   将job换成ta
select empno,empno+25||'is a '||job AS ta from emp;
--删除重复行 关键词DISTINCT
 select DISTINCT comm from emp;
--用IS NULL 关键字判断为空的情况
 select * from emp
   where comm IS NULL;
 select comm from emp
   where comm IS NULL;
 

 

二、优先级

    1 算术运算符

  2 连接符

  3 比较符

  4 IS [NOT] NULL, LIKE, [NOT] IN

  5 [NOT] BETWEEN

  6 NOT

  7 AND

  8 OR

 

posted on 2017-07-12 18:57  -薛凯-  阅读(152)  评论(0编辑  收藏  举报

导航