[英]Why sql-script isn't executed?
CREATE TABLE PERMISSIONS(
ID BIGINT NOT NULL PRIMARY KEY,
NAME VARCHAR(255) NOT NULL, UNIQUE(ID)
)
CREATE TABLE ROLES(
ID BIGINT NOT NULL PRIMARY KEY,
NAME VARCHAR(255)
)
I want to run this in MySql. 我想在MySql中运行它。 When I try to execute separately each create-query everything works fine but they don't work together.
当我尝试分别执行每个create-query时,一切正常,但它们不能一起工作。 I thought that separator was missed and tried to put semicolon after each query but MySql says that I have syntax mistake near ";"
我以为缺少分隔符,并尝试在每个查询后添加分号,但MySql说我在“;”附近有语法错误。 .
。 Where is the mistake?
错误在哪里?
It's a semi-colon. 这是一个分号。
What is the equivalent of 'go' in MySQL? MySQL中的“ go”等效项是什么?
I don't have a MySql instance running here and it's by no means my cup of tea but I believe you're supposed to separate your queries with ;. 我没有在这里运行MySql实例,这绝不是我的杯茶,但我相信您应该使用;分隔查询。
CREATE TABLE PERMISSIONS(
ID BIGINT NOT NULL PRIMARY KEY,
NAME VARCHAR(255) NOT NULL, UNIQUE(ID)
) ;
CREATE TABLE ROLES(
ID BIGINT NOT NULL PRIMARY KEY,
NAME VARCHAR(255)
)
using the queries in the mysql console with a semi-colon after the each statement works. 在每个语句工作后,使用分号在mysql控制台中使用查询。 maybe you use an api (like php's mysql_query) which only supports one query at the time.
也许您使用的API(例如php的mysql_query)当时仅支持一个查询。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.