在选择错误中插入...选择除法运算符?
如果不存在则创建表 XY ( x 整数不为空, y 浮点数为空, 主键(x) )
INSERT INTO XY (x,y)
(select 1 as x ,(1/7) as y);
错误吗?
Error code 1064, SQL state 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 'INSERT INTO XY (x,y)
(select 1 as x ,(1/7) as y)' at line 7
Line 1, column 1
有任何想法
CREATE TABLE IF NOT EXISTS XY (
x INT NOT NULL ,
y FLOAT NULL ,
PRIMARY KEY(x)
)
INSERT INTO XY (x,y)
(select 1 as x ,(1/7) as y);
errors with
Error code 1064, SQL state 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 'INSERT INTO XY (x,y)
(select 1 as x ,(1/7) as y)' at line 7
Line 1, column 1
any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该在
CREATE TABLE
语句之后(或在INSERT
语句之前)添加 ;。您正在尝试执行 2 个不带分隔符的不同查询。You should add ; after
CREATE TABLE
statement (or beforeINSERT
statement) . You are trying to execute 2 different queries without separator.select 语句需要加括号吗
do you need the parentheses around the select statement