Oracle實訓筆記1

2021-05-25 21:56:48 字數 1149 閱讀 9051

1、desc:列出表定義,列出pl/sql語句定義。

2、disc:斷開連線。conn scott/tiger@orcl :連線

3、passw:更改密碼

4、nvl()函式的使用,處理null。sal+nvl(comm,0):即當comm為null時,將它看成0,當不是null時,將其忽略。

5、如果列別名區分大小寫、包含特殊字元等,則需要雙引號擴出來。

6、多表插入:

使用子查詢將一張表中的資料根據條件插入到多張表中,包括:無條件insert all,有條件insert all,有條件insert first三種。

create table sal_history     as      select ename,hiredate,sal from emp where 1=0;【擴充套件:where 1=0 ,永遠返回false,所以只會返回表結構,而不複製資料,可用於快速建表,where 1>0或者不寫可返回所有結構。】

create table mgr_history     as      select ename,mgr,sal from emp where 1=0;

例項一:無條件的insert all

將查詢的結果無條件的複製到多個表中,例子:

insert all

into sal_history values (ename,hiredate,sal)

into mgr_history values(ename,mgr,sal)

select ename,hiredate,mgr,sal from emp;

例項二:有條件的insert all

insert all

when sal>1000 then

into sal_history values(ename,hiredate,sal)

when mgr>7700 then

into mgr_history  values(ename,mgr,sal)

select ename,hiredate,mgr,sal from emp;

7、刪除資料

delete語句,delete from emp1 where

truncate語句,truncate from emp1

區別:delete只刪除表內容,不刪除表結構,可以rollback。

實訓筆記1

actioncontext com.opensymphony.xwork.actioncontext 是action執行時的上下文,上下文可以看作是乙個容器 其實我們這裡的容器就是乙個map而已 它存放放的是action在執行時需要用到的物件,比如 在使用webwork時,我們的上下文放有請求的引數...

oracle資料庫實訓(1)

用的是11g版本 解鎖 alter user scott account unlock 設定密碼 alter user scott identified by tiger 授權 grant dba to scott用scott使用者登入,利用已有的表進行實驗 查詢語句 1.員工的實發工資 nvl x...

專案實訓(1)

研究 並根據reference實現了基於jaccard計算 對相似度的演算法 研究下面這篇 了解我們專案的整體思路。自己的實現 每次輸入兩個 的名字,然後通過查詢node.list找到相應的id,然後在inlinks.list中找到他引用的所有 集合,然後計算jaccard相似度。不足之處 在遇到大...