一.基礎知識為顯示方便,可以直接在欄位後加上標籤(別名)sum(decode())用來統計order by desc/asc 排序distinct,不顯示重複的。 分組:group by 欄位 ,與select前邊的欄位匹配。聚集合函式(max,min,sum,avg)不能出現在where中,這時用having 模糊查詢like a%,以a開頭的。 表的串連from * join * on內串連左,右外串連(非完全符合)(+) 無關子查詢 IN NOT
建立使用者create user ... identified by pwd; 刪除使用者drop user ... cascade;建立資料表空間create tablespace ts_drp datafile 'd:\drp-date.dbf' size 2000m將資料表空間分配給使用者alter user ... default tablespace ts_drp;授權grant dba(resource、CONNECT) to user回收許可權revoke
很好的一個文章,來自http://apps.hi.baidu.com/share/detail/21843741; 由於圖片無法引用,不過SQL可以直接啟動並執行。row_number() over ([partition by col1] order by col2) ) as 別名表示根據col1分組,在分組內部根據 col2排序而這個“別名”的值就表示每組內部排序後的順序編號(組內連續的唯一的),[partition by col1] 可省略。
1.通過 lsnrctl status 命令查看執行個體的狀態hs-prd:oraprd 17> lsnrctl statusLSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.2.0 - Production on 04-JA2012 04:37:52Copyright (c) 1991, 2005, Oracle. All rights reserved.Connecting to
(1) Oracle中:insert into product (id,names, price, code) select 100,'a',1,1 from dual union select 101,'b',2,2 from dual;這裡最好用一次insert,不然效率不高,用多個select. (2)Mysql中:insert into 表名(id,name) values(1,'A'),(2,'B'),(3,'C') (3)SqlServer中:INSERTINTO table_
//查看oracle資料庫中所有的資料庫物件select * from dba_objects//查看符合特定條件的資料庫物件select *from dba_objects where owner='user1'//查看資料庫版本資訊select * from product_component_version比如輸出資訊如下:PRODUCT VERSION STATUSNLSRTL 9.0.1.1.1 ProductionOracle9i Enterprise Edition 9.0.1