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
  • 325,700
  • 82
  • 523
  • 502
Roman
  • 64,384
  • 92
  • 238
  • 332

3 Answers3

0

It's a semi-colon.

What is the equivalent of 'go' in MySQL?

Community
  • 1
  • 1
Austin Salonen
  • 49,173
  • 15
  • 109
  • 139
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
  • 46,766
  • 14
  • 87
  • 128
Lieven Keersmaekers
  • 57,207
  • 13
  • 112
  • 146
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
  • 29,200
  • 6
  • 68
  • 84