创建视图:create view [name] as [sql],
CREATE VIEW pro AS SELECT pro_name, pro_price FROM products;
查看视图:
describe view1; 或 select * from information_schema.views where table_name='view1';
修改视图:create or replace view [] ; alter view []
create or replace view pro as select pro_name from products; 或 alter view pro as select pro_name from products;
删除视图:drop view pro;
创建视图目的:
隐藏数据的复杂性:比较常用的复杂的sql语句,直接创建视图;
实现数据访问的安全性:(授权语句)
GRANT select,update,insert,delete ON db_test.proView TO 'user1'@'%' IDENTIFIED BY '123456';
一定条件下,可通过视图 添加删除 记录。