DB2操作樣例資料庫

2021-05-22 01:52:18 字數 794 閱讀 7787

在linux終端輸入db2fs,系統開啟db2 first step 工具。然後選擇database creation —> create sample database ,即可以建立樣例資料庫。

然後在命令列執行 db2 connect to sample 可以連線上資料庫,

再執行  db2 "select * from staff where dept >20 "  可以查詢出符合條件的記錄,注意不要把引號省略。

或者可以執行db2 ,進入db2的命令列,然後直接輸入db2的命令:

如  connect to sample  和 select * from staff where dept >20 。

the db2 clp (db2 命令列)has two parts: a front-end process and a back-end process. the

front-end process is called db2 and the back-end is db2bp.the back-end process

will maintain a connection to the database. to release this connection, use theterminate

command. to end an interactive db2 clp session, issue thequitcommand  ( this does not release the database connection ).

DB2資料庫相關操作

自增字段的建立 start with 1 increment by 1 cache 20 no cycle no order 設定自增序列從20001開始 alter sequence linkage seq restart with 20001 使用自增字段 插入一條資料insert into l...

DB2 命令 資料庫操作

標籤 空格分隔 db2例項 db2授權 資料庫 資料庫名稱 database name lqr 使用者名稱 user name lqr 檢視表空間名稱 db2 list tablespaces show detail 表空間名稱 需要大寫 tablesapce name userspace1 例項或...

全新db2資料庫操作

前提 乙個全新的資料庫沒有任何庫。1 通過遠端桌面連線到資料庫所在的電腦,2 執行db2cmd administartor.由於使用的是administrator登入的遠端桌面,在登入進去的時候就administrator就是db2的超級管理員。首先要明白乙個道理,資料庫的超級管理員才能給使用者授權...