- バックアップ一覧
- ソース を表示
- バックアップ を表示
- PostgreSQL/自己結合/SQL/自己結合 は削除されています。
- 1 (2006-12-07 (木) 21:42:43)
- 追加された行はこの色です。
- 削除された行はこの色です。
* SQL [#z36167d2]
** [[データ型書式設定関数>http://www.postgresql.jp/document/pg746doc/html/functions-formatting.html]] [#cff17534]
select to_char(now(), 'YYYY-MM-DD HH24:MI:SS');
http://www.postgresql.jp/document/pg746doc/html/functions-formatting.html
** シーケンス [#c11984c1]
select currval('t1_id_seq'); # => 直前に挿入したテーブルt1のカラムidの値
select nextval('t1_id_seq'); # => 次にテーブルt1に挿入する時のカラムidの値
** 主キーの削除 [#b1811695]
alter table users drop constraint users_pkey ;
** 主キーの追加 [#o0b671a5]
ALTER TABLE users ADD primary key ( user_id );
** トリガー [#f1619a15]
トリガー一覧
select * from pg_trigger;
割り当てられている関数名
select tgname,proname from pg_trigger t, pg_proc f
where t.tgfoid = f.oid
and tgname = 'TGNAME';
** 型変更(ALTER TABLE) [#c6fcbacd]
できない。
** UNIXタイム(EPOCHタイム)の取得 [#dbd794f8]
select extract(epoch from COLUMN_NAME) from TABLE_NAME;