gpt4 book ai didi

mysql - 无法创建 MySQL View

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

我运行此 SQL 代码来创建 View ,但这不起作用:

Create VIEW as
select
c.ID_CAPTEUR as ID_CAPTEUR,
d.ID_CAPTURE as ID_CAPTURE,
d.VALEUR_CAPTURE as valeur,
d.DATE_CAPTURE,
t.INTITULE_TYPE_CAPTURE as TYPE_CAPTURE,
z.INTITULE_ZONE as zone,
r.INTITULE_REGION as region
from CAPTEUR c, CAPTURE d, TYPECAPTURE t, ZONE z, REGION r
where c.ID_CAPTEUR=d.ID_CAPTEUR
and d.ID_TYPE_CAPTURE=t.ID_TYPE_CAPTURE
and c.ID_ZONE = z.ID_ZONE
and z.ID_REGION = r.ID_REGION

我收到此错误:

1064 - 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 'as select c.ID_CAPTEUR as ID_CAPTEUR , d.ID_CAPTURE as ID_CAPTURE , d.VALEUR_CAP' at line 1

最佳答案

这是 CREATE VIEW 的语法声明:

CREATE
[OR REPLACE]
[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]
VIEW view_name [(column_list)]
AS select_statement
[WITH [CASCADED | LOCAL] CHECK OPTION]

如您所见,您的查询缺少 view_name 参数([] 之间的参数是可选的,但情况并非如此view_name)。

关于mysql - 无法创建 MySQL View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24218491/

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