oracle 表的基本查询
<DIV><FONT color=#800080 size=4>表的基本查询</FONT></DIV><DIV><FONT color=#800080 size=4> 1,查看表结构</FONT></DIV>
<DIV><FONT color=#800080 size=4> Desc dept;</FONT></DIV>
<DIV><FONT color=#800080 size=4> 2,查看所有列 </FONT></DIV>
<DIV><FONT color=#800080 size=4> select * from dept;</FONT></DIV>
<DIV><FONT color=#800080 size=4> 3, 查看指定列</FONT></DIV>
<DIV><FONT color=#800080 size=4> select ename,sal,job,deptno from emp;</FONT></DIV>
<DIV><FONT color=#800080 size=4> 4,如何取消重复</FONT></DIV>
<DIV><FONT color=#800080 size=4> select distinct deptno,job from emp;</FONT></DIV>
<DIV><FONT color=#800080 size=4> 5,set timing on; 显示查询时间</FONT></DIV>
<DIV><FONT color=#800080 size=4> 6,使用算术表达式</FONT></DIV>
<DIV><FONT color=#800080 size=4> ? 显示每个雇员的年工资</FONT></DIV>
<DIV><FONT color=#800080 size=4> select(sal+nvl(comm,0))*12 as 年工资,ename as 姓名 from emp;</FONT></DIV>
<DIV><FONT color=#800080 size=4> 使用列的别名</FONT></DIV>
<DIV><FONT color=#800080 size=4> select ename "姓名",sal*12 as "年收入" from emp;</FONT></DIV>
<DIV><FONT color=#800080 size=4> ? 如何使用null值</FONT></DIV>
<DIV><FONT color=#800080 size=4> 使用nvl函数来处理</FONT></DIV>
<DIV><FONT color=#800080 size=4> 如何连接字符串(||)</FONT></DIV>
<DIV><FONT color=#800080 size=4> select ename || 'is a '|| job from emp;</FONT></DIV>
<DIV><FONT color=#800080 size=4> 7, 使用where 子句</FONT></DIV>
<DIV><FONT color=#800080 size=4> ?如何显示工资高于3000的员工</FONT></DIV>
<DIV><FONT color=#800080 size=4> <a href="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201109/17/25472509_1316258791kp8B.jpg" target="_blank"><IMG src="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201109/17/25472509_1316258791kp8B.jpg" .load="imgResize(this, 650);" border=0 ;></A></FONT></DIV>
<DIV><FONT color=#800080 size=4> 。。。。。</FONT></DIV>
<DIV><FONT color=#800080 size=4> </FONT></DIV>
<DIV><FONT color=#800080 size=4> </FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#800080 size=4> </FONT></DIV>
页:
[1]