MySQL创建视图命令
CREATE ALGORITHM = UNDEFINED
DEFINER = `root`@`localhost`
SQL SECURITY DEFINER
VIEW girl_users_view AS
(SELECT g.id,g.age,g.size,g.city_type,g.`name`,u.username,u.nickname FROM users u INNER JOIN girl g ON g.id=u.id)
几点说明(MySQL中的视图在标准SQL的基础之上做了扩展):
ALGORITHM=UNDEFINED:指定视图的处理算法;
DEFINER=`root`@`localhost`:指定视图创建者;
SQL SECURITY DEFINER:指定视图查询数据时的安全验证方式;
修改视图
ALTER ALGORITHM = UNDEFINED
DEFINER = `root`@`localhost`
SQL SECURITY DEFINER
VIEW girl_users_view AS
(SELECT g.age,g.size,g.city_type,g.`name`,u.username,u.nickname FROM users u INNER JOIN girl g ON g.id=u.id)