* DB メモ [#je242e5a] #contents ** Oracle [#ceffeec9] *** 接続 [#o5957af6] sqlplus ユーザ名/パスワード@SID *** トランザクション [#d83e0788] "commit" でコミット。 *** テーブル一覧表示 [#r995d285] select table_name from user_tables; (select table_name from all_tables;) *** カラム一覧表示 [#lf3f03df] desc テーブル名; *** その他よく使うコマンド [#c1909e1c] ''フィールド型変更'' alter table テーブル名 modify (列名 型名); ''カラム追加'' alter table テーブル名 add ( カラム名1 型名1 [default デフォルト値] [not null], ... ); ''主キー変更'' alter table テーブル名 drop constraint キー名; alter table テーブル名 add constraint キー名 primary key ( カラム名1, ... ); ''制約名を調べる'' select constraint_name from user_constraint where table_name ='テーブル名'; ''not null 制約をつける'' alter table テーブル名 modify ( カラム名 not null ); ''not null 制約をはずす'' alter table テーブル名 modify ( カラム名 null ); *** その他Tips [#zfccc0df] - union できない → CLOB が含まれると union 不可。重複OKなら union all でいける。 ** Microsoft SQL Server [#j4728785] *** 接続 [#gab19d82] osql -S"ホスト名" -d"DB名" -U"ユーザ名" -P"パスワード" *** トランザクション [#j680aa48] "go" でステートメントを完了すると、オートコミット。(既定) *** テーブル一覧表示 [#k1c33f6d] select name from sysobjects where xtype = 'S' or xtype = 'U' or xtype = 'V' *** カラム一覧表示 [#x4aadc20] sp_columns テーブル名 ** MySQL [#y74a92c6] *** 接続 [#b9f83938] mysql -u"ユーザ名" -p"パスワード" [DB名] *** トランザクション [#m96ab3d0] *** テーブル一覧表示 [#je972eb5] show tables *** カラム一覧表示 [#hae80d2b] show columns from (テーブル名) ** PostgreSQL [#ka55931c] *** 接続 [#o5ab8747] psql -h "ホスト名" -U "ユーザ名" -d "DB名" 続けてパスワード入力。 *** トランザクション [#a7e931d2] *** テーブル一覧表示 [#od7cf852] \d select * from pg_tables; *** カラム一覧表示 [#e0e69d3a] \d テーブル名 ----- [[MLEXP. Wiki]] #googleads(1,1)