DB2數(shù)據(jù)庫表中將數(shù)據(jù)移入或是移出數(shù)據(jù)庫實戰(zhàn)演示
下面的文章主要介紹的是DB2數(shù)據(jù)庫表中將數(shù)據(jù)移入或是移出數(shù)據(jù)庫的實際操作步驟,我前兩天在相關(guān)網(wǎng)站看見DB2數(shù)據(jù)庫表中將數(shù)據(jù)移入或是移出數(shù)據(jù)庫的實際操作步驟的資料,覺得挺好,就拿出來供大家分享。
在DB2數(shù)據(jù)庫中創(chuàng)建了存儲數(shù)據(jù)的表之后,需要能夠?qū)?shù)據(jù)移入或移出表。將數(shù)據(jù)放入表中最簡單的方法是使用 INSERT 命令。為了插入數(shù)據(jù),要提供想插入數(shù)據(jù)的表和列以及數(shù)據(jù)本身。
在DB2數(shù)據(jù)庫中創(chuàng)建了存儲數(shù)據(jù)的表之后,需要能夠?qū)?shù)據(jù)移入或移出表。將數(shù)據(jù)放入表中最簡單的方法是使用 INSERT 命令。為了插入數(shù)據(jù),要提供想插入數(shù)據(jù)的表和列以及數(shù)據(jù)本身。在插入數(shù)據(jù)之后,就可以選擇、更新或刪除它。
這個練習(xí)演示如何將數(shù)據(jù)移入或移出數(shù)據(jù)庫。
在 Control Center Object 視圖中,選擇數(shù)據(jù)庫列表中的 AUTHOR 表并點擊 Open。
圖1. Control Center —— 打開表
如下圖所示,點擊 Add Row。將數(shù)據(jù)輸入列中并提交事務(wù)。
圖2. 添加行
如果沒有出現(xiàn)錯誤,就沒有反饋。點擊 Close 關(guān)閉 Open Table 窗口。
通過 Tools > Command Editor 打開 Command Editor。手工輸入 INSERT 命令,包括連接DB2數(shù)據(jù)庫的語句:
- connect to hellowld;
- insert into hwld.author values ('Claire', 1, 'DB2 UDB',
- '<author_info>
- <name>Claire</name>
- <ID>1</ID>
- <department>
- <department_title>DB2 CE</department_title>
- <responsibility>Supporting customer problems</responsibility>
- <start_year>2005</start_year>
- </department>
- <department>
- <department_title>DB2 Index Manager</department_title>
- <responsibility>Develop new features for DB2 indexes</responsibility>
- <start_year/>
- </department>
- </author_info>', 100);
- terminate;
(還可以使用命令編輯視圖執(zhí)行同樣的操作。)
點擊綠色的三角圖標(biāo)運行命令。圖3顯示預(yù)期的運行結(jié)果:
圖3. Command Editor —— 插入
如果表中有不再需要的數(shù)據(jù),可以使用同樣的窗口刪除它。點擊表 AUTHOR 和 Open。
選擇第一行并點擊 Delete Row。點擊 Commit 提交刪除操作。如果決定中止刪除操作,那么點擊 Roll Back 而不是 Commit。
點擊其他行并刪除它以清空這個表,然后點擊 Close。上述的相關(guān)內(nèi)容就是對DB2數(shù)據(jù)庫表中如何將數(shù)據(jù)移入或移出數(shù)據(jù)庫的描述,希望會給你帶來一些幫助在此方面。
【編輯推薦】
- DB2數(shù)據(jù)庫如何正確取得當(dāng)前時間
- DB2 Resotre的使用技巧的描述
- DB2 聚集目標(biāo)表的關(guān)鍵作用分析
- 讓DB2數(shù)據(jù)庫對所有內(nèi)存進行使用
- DB2實例無法啟動在修改機器名后的原因