gpt4 book ai didi

mysql - SQL.查看命令错误

转载 作者:行者123 更新时间:2023-11-29 18:29:43 25 4
gpt4 key购买 nike

我创建了两个表并使用 View 合并它们。我无法更新 View 表。更新命令不起作用。它会出现错误“数据操作操作在此 View 上不合法”。

SQL>UPDATE library 
SET bookno=176 WHERE rackno=33;

这里的library是 View 名称。谁能给我答案吗?

最佳答案

来自手册:https://dev.mysql.com/doc/refman/5.7/en/view-updatability.html

For a view to be updatable, there must be a one-to-one relationship between the rows in the view and the rows in the underlying table. There are also certain other constructs that make a view nonupdatable. To be more specific, a view is not updatable if it contains any of the following:

Aggregate functions (SUM(), MIN(), MAX(), COUNT(), and so forth)

DISTINCT

GROUP BY

HAVING

UNION or UNION ALL

关于mysql - SQL.查看命令错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45799382/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com