介绍:视图(Vview)是一种虚拟存在的表。视图中的数据并不在数据库中实际存在,行和列数据来自定义视图的查询中使用的表,并且是在使用视图时动态生成的。
CREATE [OR REPLACE] VIEW 视图名称(列名列表)]AS SELECT语句[ WITH[ CASCADED | LOCAL] CHECK OPTION]
create or replace view stu_v_1 as select id ,name from student where id <= 10;
查看创建视图语句: SHOW CREATE VIEW视图名称;
查看视图数据: SELECT * FROM视图名称……. ;
show create view stu_v_1;
select * from stu_v_1;
select from stu_v_1 where id < 3;
方式一 : CREATE [OR REPLACE] VIEW 视图名称[(列名列表)]AS SELECT语句[WITH[ CASCADED | LOCAL ] CHECK OPTION]
方式二 : ALTER VIEW 视图名称(列名列表)] AS SELECT语句[ WITH [ CASCADED | LOCAL] CHECK OPTION ]
create or replace view stu_v_1 as select id , name ,no from student where id <= 10;
alter view stu_v_1 as select id , name from student where id <= 10;
DROP VIEW [IF EXISTS] 视图名称 [,视图名称]…
正在学习Go语言的PHP程序员。