daron
daron

Reputation: 39

Detect SQL dialect

I would like to know which SQL dialect is being used in the snippet. Is it MSSQL, MySQL, PL/SQL or is it invalid SQL?

CREATE TABLE ACTable (
    id int NOT NULL,
    x float NOT NULL,
    y float NOT NULL,
    z float NOT NULL
)
CONSTRAINT [PK_FTTable] PRIMARY KEY( id )

Upvotes: 2

Views: 2413

Answers (3)

HLGEM
HLGEM

Reputation: 96572

The SQL is incorrect but this SQL would work in SQL Server:

CREATE TABLE ACTable (
    id int NOT NULL,
    x float NOT NULL,
    y float NOT NULL,
    z float NOT NULL
CONSTRAINT [PK_FTTable] PRIMARY KEY( id ))

Upvotes: 3

Juan Carlos Oropeza
Juan Carlos Oropeza

Reputation: 48197

This part is OK in almost every rdbms

CREATE TABLE ACTable (
    id int NOT NULL,
    x float NOT NULL,
    y float NOT NULL,
    z float NOT NULL
)

The problem is the constraint, and doesnt look like a valid statment for any db.

You can try that CREATE TABLE on every rdmbs on sqlFiddle.

Upvotes: 1

Gordon Linoff
Gordon Linoff

Reputation: 1269873

As far as I know, it is not valid SQL.

Every database that I can think of requires an alter table . . . for adding a constraint.

Of course, there are databases I can't readily think of. But I go with it is just an error. After all, there is no context for the table affected by the constraint.

Upvotes: 0

Related Questions