0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

DB2コマンド 備忘録

0
Posted at

DB2備忘録

# db2インスタンス起動
db2start
# データベース接続
# db2 connect to (DB名) user (username) using (password)
db2 connect to TESTDB user testuser using PasswordTest
# 現在のスキーマを確認
db2 values current schema
# スキーマ一覧
db2 select schemaname from SYSCAT.SCHEMATA
# テーブル一覧
db2 list tables
# テーブル項目
# db2 describe table (テーブル名)
db2 describe table TEST_TABLE
# インスタンスに作成済みのデータベースをリスト
db2 list db directory

以降は通常のSQLと同一

# テーブル作成
db2 "create table test (id int, col1 varchar(100))"
# テーブルにデータ追加
#db2 "insert into スキーマ名.test values (2, '結合テスト')"
db2 "insert into test values (1, '引っ越し')"
# テーブルデータ確認
db2 "select * from test"
...

(db2の癖つよい)

IBMドキュメント:DB2 SQLステートメント

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?