mysql视图
1. 视图可以叫sql语句更简单
2. 保护数据给不同的人看不同的数据
create view view_table as select *from table_name;
creaate view stu asselect a.name,a.age,a.email,a.phone,b.phpc,b.javac,b.oraclec from student a,score b where a.id=b.sid;
create [or replace] [algorithm={merge|temptable|undefined}]
view view_name [(column_list)]
as select_statement
[with [cascaded|local] check option]
视图有三种类型
Merge:会将引用视图的语句的文本与视图定义结合起来,使用得视图定义的某一部分取代语句对应部分
Temptable
undefined 没有指定默认 merge
algorithm=merge
with local check option with[local]只要满足本视图的条件就可以更新
with cascaded check option with [cascaded]必须满足所有针对视图的条件,才可以跟新
操作视图
alter view student_view as select *from student
drop view stu..,视图
show table status like 'stu2'/G'
show create view stu/G