开发者

Why sql-script isn't executed?

CREATE TABLE PERMISSIONS(
   ID BIGINT NOT开发者_JAVA百科 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. When I try to execute separately each create-query everything works fine but they don't work together. I thought that separator was missed and tried to put semicolon after each query but MySql says that I have syntax mistake near ";" . Where is the mistake?


using the queries in the mysql console with a semi-colon after the each statement works. maybe you use an api (like php's mysql_query) which only supports one query at the time.


It's a semi-colon.

What is the equivalent of 'go' in MySQL?


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 ;.

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)
)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜