我运行此SQL代码来创建视图,但这不起作用:
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
答案 0 :(得分:0)
这是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
参数([
和]
之间的参数是optionnal,而view_name
不是这种情况。)< / p>