视图是从一个或者多个表导出的出局,与表非常相似但是视图没有物理记录,不占用物理空间,只是逻辑上存在,保障数据表的安全。
- 创建视图
create view view_name as select field1,field2 from table;
create view view_name(field1,field2) as select field1,field2 from table;
- 修改视图
create or replace view view_name as select field1,field2 from table;
create or replace view view_name(field1,field2) as select field1,field2 from table;
- 查询视图
select * from view_name;
- 查看视图
show create view view_name;
drop view if exists view_name;