Posted on 2010-06-30 00:45
断点 阅读(220)
评论(0) 编辑 收藏 所属分类:
Oracle DBA
sqlplus sys/sys as sysdba;
alert user scott account unlock;
desc emp;
select ename,sal*12 from emp;
select sysdate from dual; --dual为空表
select ename,sal*12 annual_sal from emp; --别名
--数值+null 为null
select ename||sal from emp; --拼串
select ename||'aaa''bbb' from emp; --含'的拼串,''替换为'
select distinct deptno,job from emp; --去掉2个字段值的组合
select * from emp where deptno=10 and ename='CLARK';
select ename,sal from emp where sal>1500;
select ename,sal from emp where deptno<>10;
select ename,sal from emp where sal between 800 and 1500; -- sal>=800 and sal<=1500
select ename,sal,comm from emp where comm is null; --is not null
select ename,sal,comm from emp where sal in (800,1500); -- not in (800,1500)
select ename from emp where ename like '_A%' -- %为0个或多个,-为1个
select ename from emp where ename like '%\%%' -- 名字含有%,需要\为转义字符处理
select ename from emp where ename like '%$%%' escape '$' -- 可以使用$作为转义字符
select ename,sal,deptno from emp order by deptno asc,ename desc; -- 升序asc,降序 desc