首先是创建视图 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `new_view` AS (select `girls`.`id` AS `id`,`girls`.`name` AS `name`,`girls`.`age` AS `age`,`girls`.`level` AS `level` from `girls`); 红色的代码时mysql自动生成的, 一般创建VIEW的SQ
>>>>>> >>>> 创建视图: create view goodsavgview as select cat_id,avg(shop_price) as avgshop_price from goods group by cat_id 1.视图是什么? 答:视图是一个虚拟的表,没有实实在在的数据,是通过表运算得出的数据 特点:(1)表数据随原表数据的变动而变. (2)只有当视图表与原表一一对应时,才能被更新 (3)简化查询 (4)可以很好的控