- 2009-03-21 (土) 13:47
- 設定資料
既存のViewにカラムを追加するには
ALTER VIEW
を使うらしい。
まずView作成
CREATE view_table AS
SELECT
table_a.カラム1,
table_a.カラム2,
table_b.カラム3
FROM table_a
LEFT JOIN table_b
ON table_b.id = table_a.id;
作成したViewにカラム4を追加
ALTER VIEW view_table AS
SELECT
table_a.カラム1,
table_a.カラム2,
table_b.カラム3,
table_b.カラム4
FROM table_a
LEFT JOIN table_b
ON table_b.id = table_a.id;
CREATE OR REPLACE VIEW はどういう時に使うんだろ・・・
IF NOT EXISTSみたいな物かな?
CREATE OR REPLACE VIEW view_table AS
SELECT
table_a.カラム1,
table_a.カラム2,
table_b.カラム3,
table_b.カラム4
FROM table_a
LEFT JOIN table_b
ON table_b.id = table_a.id;
- Newer: IE8のアクセラレータは以外と便利♪
- Older: PHPアクセラレーター
Comments:0
Trackbacks:0
- Trackback URL for this entry
- http://acoustype.com/archives/540/trackback
- Listed below are links to weblogs that reference
- Viewにカラムを追加するには from acoustype.com