查看表結構
desc ? emp;
查詢所有列
Select * from emp;
查找所以部門編號(查指定的列)
select ? deptno from ? emp;
查找編號不同的部門編號(去重)
select distinct ? deptno from ? emp;
查找 ename 為 SMITH 的員工職位,工資,部門編號
select ? job,sal,deptno from ? emp? t? ? where ? t.ename= 'SMITH' ;
查找員工的年薪
NVL( string1, replace_with)
功能:如果string1為NULL,則NVL函數返回replace_with的值,否則返回string1的值
SELECT ? sal* 12 + nvl (comm, 0 )* 12 as ? salsun , ename,sal,comm? ? from ? emp
別名的應用
select ? sal as ? " 工資 " from ? emp
查詢工資大于 1000 的員工工資
select ? sal as ? " 工資 " from ? emp where ? sal> 1000
查找 1982.1.1 后入職的員工
select ? ename,hiredate from ? emp where ?? hiredate> '1-1 月 -1982'
顯示工資在 2000 到 3000 的員工
select ? ename,sal from ? emp where ? sal>= 2000 and ? sal<= 3000 ;
模糊查詢 like,%,_
select ? ename,sal from ? emp? t?? ? where ? t.ename like '%S%' ;
select ? ename,sal from ? emp t? where ? t.ename like '_O%' ;
in 的使用
select ? sal,ename from ? emp t where ? t.sal in ( 800 , 1600 )
is null 的使用
select ? * from ? emp where ? mgr is null ;
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
