0
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. 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?

OMG Ponies
  • 314,254
  • 77
  • 507
  • 490
Roman
  • 61,962
  • 88
  • 232
  • 324

3 Answers3

0

It's a semi-colon.

What is the equivalent of 'go' in MySQL?

Community
  • 1
  • 1
Austin Salonen
  • 47,582
  • 15
  • 104
  • 136
0

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)
)
Tom H
  • 45,807
  • 14
  • 84
  • 124
Lieven Keersmaekers
  • 55,505
  • 12
  • 105
  • 142
0

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.

Rufinus
  • 26,947
  • 6
  • 65
  • 81