1、创建视图
- #在单表上创建上视图
- create algorithm=merge
- view info_view(name,xinbie,address)
- as select name, xinbie, address
- FROM work_info WHERE age>20
- WITH LOCAL CHECK OPTION;
2、查看详细结构的代码如下:
SHOW CREATE VIEW info_view
3、查看视图info_view的所有记录
SELECT * FROM info_view;
4、修改视图info_view
ALTER ALGORITHM=MERGE VIEW
info_view ( id,name, xinbie, address )
AS SELECT id,name, xinbie, address
FROM work_info WHERE age<20
WITH LOCAL CHECK OPTION;
5、删除视图
DROP VIEW info_view;
阅读(667) | 评论(0) | 转发(0) |