在mysql中更新查询内部视图
我们可以将更新查询放在视图中吗?如果是,请告诉我为什么会出现上述错误。我想增加工资并使用view显示它。为什么不这样做在mysql中更新查询内部视图,mysql,Mysql,我们可以将更新查询放在视图中吗?如果是,请告诉我为什么会出现上述错误。我想增加工资并使用view显示它。为什么不这样做 mysql> create view incremented_salary as -> update employee set salary=salary*1.1; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to y
mysql> create view incremented_salary as
-> update employee set salary=salary*1.1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to use near
'update employee set salary=salary*1.1' at line 2
视图不修改表的值
它们为您提供了一个关于它们的新视图-例如,连接多个表,聚合,或者基于表值重新计算一些值
如果你尝试的方法有效,那么每次你查看数据时,它的价值都会增加
create view incremented_salary as
select salary*1.1 from wahtevertable