The concept of a key-preserved table is fundamental to understanding the restrictions on modifying join views. A table is key preserved if every key of the table can also be a key of the result of the join. So, a key-preserved table has its keys
一.有資料檔案、控制檔案和記錄檔的備份1.伺服器重裝了作業系統,oracle也重裝了。如果重裝的oracle和以前損壞的資料庫是一模一樣的結構,那麼此時的恢複是比較簡單的。1)刪除掉建立資料庫的所有資料檔案、控制檔案和記錄檔。Copy原資料庫的資料檔案、控制檔案和記錄檔到對應目錄下。2)Cmd>sqlplus /nologSql>conn as sysdba使用者名稱:system密碼:(此處密碼為新建立資料庫的密碼)Sql>shutdown immediateSql>
避免在索引列上使用NOT 通常, 我們要避免在索引列上使用NOT, NOT會產生在和在索引列上使用函數相同的影響. 當ORACLE”遇到”NOT,他就會停止使用索引轉而執行全表掃描.(22) 避免在索引列上使用計算.WHERE子句中,如果索引列是函數的一部分.最佳化器將不使用索引而使用全表掃描. 舉例: 低效: SELECT … FROM DEPT WHERE SAL * 12 > 25000; 高效: SELECT … FROM DEPT WHERE SAL > 25000/12
in 與 exist 的文法比較: select × from 資料表 t where t.x in (...) 括弧內可以是符合t.x欄位類型的值集合,如('1','2','3'),但如果t.x是number類型的時候,似乎這樣的寫法會出問題;也可以是通過另外的select語句查詢出來的值集合,如(select y from 資料表2 where ...)。 select * from 資料表 t where [...] and
/*函數名稱:oracle 字元按位或函數參數約束:p1與p2的長度必須一致*/create or replace function F_BITOR(p1 in string, p2 in string) return varchar2 is Result varchar2(16); t_p number(3); r_p varchar2(16); p_p number(3); c_1 char(1); c_2 char(1);begin t_p := length(p1);
今天在整理以前跟一個老前輩合作的項目實施文檔時,發現文檔裡面記錄的一個比較牛的sql語句,拿出來給大家分享一下:--sample表結構和sample_clone表結構完全相同insert into sample(name,address,phonenumber) values('aa','wuhan.hubei','13871247000);insert into sample(name,address,phonenumber) values('bb','wuhan.hubei','138712
關係代數中的操作可以分為兩類:(一):傳統的集合操作。並,差,交,笛卡爾積。(二):擴充的關係操作:投影(關係表的垂直分隔),選擇(關係表的水平分隔),串連(關係表的結合),除法(笛卡爾積的逆運算)。1.並 -- Union 在oracle 裡面的並有兩種union,union all。區別在於union過濾重複行!一般在沒有重複行的時候使用union all這樣查詢的效率快。eg: select * from A union (all) select * from B 2.差 --
在用hibernate的時候,無意間用了_teacher這個作為表名。然後就遇到了ora-00911這個錯誤。後來查了一下oracle錯誤文檔,如下:ORA-00911 invalid character CauseSpecial characters are valid only in certain places. If special characters other than $, _, and # are used in a name and the name is not
create table test(a varchar2(20),b number(2))重名命alter table test rename to test1(rename test1 to test2)增刪欄位 alter table test2 drop column f修改欄位類型和大小alter table test2 modify d varchar(40)alter table test2 modify f varchar(40) alter table test2