创建/修改视图
create or replace view acc_v_1 as select *from account where id<=2
查看视图的建表语句
show create view acc_v_1
查看视图数据
select*from acc_v_1
select*from acc_v_1 where id<=2
修改视图
alter view acc_v_1 as select name from account where id=2
删除视图
drop view if exists acc_v_1
create or replace view acc_v_1 as select id,name from account where id<=20 with cascaded check option;
select*from acc_v_1;
insert into acc_v_1 values(7,'tom');
insert into acc_v_1 values(40,'tom');
create or replace view acc_v_1 as select id,name from account where id<=20;
create or replace view acc_v_2 as select id,name from acc_v_1 where id>=10 with cascaded check option;
insert into acc_v_2 values(40,'tom');
mysql视图
最新推荐文章于 2024-05-21 09:46:31 发布