DB メモ †Oracle †接続 †sqlplus ユーザ名/パスワード@SID トランザクション †"commit" でコミット。 テーブル一覧表示 †select table_name from user_tables; (select table_name from all_tables;) カラム一覧表示 †desc テーブル名; その他よく使うコマンド †フィールド型変更 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 †
Microsoft SQL Server †接続 †osql -S"ホスト名" -d"DB名" -U"ユーザ名" -P"パスワード" トランザクション †"go" でステートメントを完了すると、オートコミット。(既定) テーブル一覧表示 †select name from sysobjects where xtype = 'S' or xtype = 'U' or xtype = 'V' カラム一覧表示 †sp_columns テーブル名 MySQL †接続 †mysql -u"ユーザ名" -p"パスワード" [DB名] トランザクション †テーブル一覧表示 †show tables カラム一覧表示 †show columns from (テーブル名) PostgreSQL †接続 †psql -h "ホスト名" -U "ユーザ名" -d "DB名" 続けてパスワード入力。 トランザクション †テーブル一覧表示 †\d select * from pg_tables; カラム一覧表示 †\d テーブル名 |