標籤:--選擇部門中30的僱員SELECT * from emp where DEPTNO=30;--列出所有辦事員的姓名、部門、編號--採用內串連方式,也就是等值連結,也是最常用的連結SELECT ename,empno,dname from emp e INNER JOINdept d on e.deptno=d.deptno where job=‘CLERK‘;--找出傭金高於薪金的僱員select * from emp where
標籤:oracle 隱式轉換 索引 都說Oracle存在NUMBER和VARCHAR2類型的隱式轉換,嚴格意義上需要避免,但為何需要避免,從下面的實驗進行驗證。1. 建立測試表和索引create table tn (id number, name varchar2(1));create index idx_tn on tn (id);create index idx_tn on
標籤:下面是轉換函式 to_charselect to_char(sysdate,‘yyyy‘) from dual;select to_char(sysdate,‘fmyyyy-mm-dd‘) from dual;select to_char(sysdate,‘yyyy-mm-dd‘) from dual;select to_char(sysdate, ‘DDD‘) from dual; 一年中的第幾天select to_char(sysdate,
標籤:1.建立使用者(需以DBA許可權登入)create user 使用者名稱 identified by 密碼;建立使用者之後,要對其進行授權,如果不對其進行授權,將不能登入資料庫,也不能做任何操作:grant connection,resource to 使用者;其中:connection和resource是oracle內建的兩個角色,兩個角色的的基本情況如下:CONNECT角色:--是授予終端使用者的典型權利,最基本的ALTER SESSION --修改會話CREATE CLUSTER -
標籤:摘自:Requirements for Installing Oracle 11gR2 RDBMS on RHEL (and OEL) 5 on AMD64/EM64T (文檔 ID 880989.1)NOTE: Starting with Oracle Database 11g Release 2 (11.2.0.2), all the 32-bit packages, except for gcc-32bit-4.3, listed in the following sections
標籤:第一掌 避免對列的操作任何對列的操作都可能導致全表掃描,這裡所謂的操作包括資料庫函數、計算運算式等等,查詢時要儘可能將操作移至等式的右邊,甚至去掉函數。 例1:下列SQL條件陳述式中的列都建有恰當的索引,但30萬行資料情況下執行速度卻非常慢: select * from record where substrb(CardNo,1,4)=‘5378‘(13秒) select * from record where
標籤:dblink的主要作用是兩個資料庫間的資料訪問(1)global_name查看select * from global_name;(2)查看本地的global_names參數 show parameter global_namesNAME TYPE VALUE------------------------------------ ----------- -----------------------------
標籤:1. 笛卡爾集select * from emp, dept;2. 等值串連select ename, job from emp, deptwhere emp.deptno=dept.deptno;3. 非等值串連select ename, grade from emp, salgradewhere sal between losal and hisal;這個其實我不太明白到底是怎麼弄的。前面的兩種都容易理解,這個難道是拿一個sal就去salgrade中找在哪個範圍?4.
標籤:http://www.cnblogs.com/hxw/archive/2005/09/11/234619.html1.根據ROWID來分select * from t_xiaoxi where rowid in(select rid from (select rownum rn,rid from(select rowid rid,cid fromt_xiaoxi order by cid desc) where rownum<10000) where rn>9980