So I'm trying to create a table in SQL and then insert values into it. However, I seem to be getting this error:
[Error Code: -12101, SQL State: 42000] Syntax error, 'CHECK' assumed missing
and
[Error Code: -12233, SQL State: 42000] The number of insert values is not the same as the number of object columns
Here is my SQL code:
CREATE TABLE Server(
Nummer INTEGER NOT NULL
PRIMARY KEY(Nummer)
);
INSERT INTO Server(Nummer)
VALUES (1,2,3,4,5);
So I want to create a table named Server
which has a primary key named nummer
. Nummer then has the values 1,2,3,4,5
UPDATE--------------------------------------------------------------------
So my new code is:
CREATE TABLE Server(
Nummer INTEGER NOT NULL,
PRIMARY KEY(Nummer),
);
INSERT INTO Server(Nummer)
VALUES (1);
INSERT INTO Server(Nummer)
VALUES (2);
INSERT INTO Server(Nummer)
VALUES (3);
INSERT INTO Server(Nummer)
VALUES (4);
INSERT INTO Server(Nummer)
VALUES(5);
I solved the check problem by simply putting a comma after every statement in the create section.
But I got a new problem which is this error code:
[Error Code: -12101, SQL State: 42000] Syntax error, IDENTIFIER IDENTIFIER assumed missing
You have a table with a single colums so you can use multiple insert as
INSERT INTO Server(Nummer)
VALUES (1);
INSERT INTO Server(Nummer)
VALUES (2);
.....
OR If you want batch insert you should use this way
INSERT INTO Server(Nummer)
VALUES (1),(2),(3),(4),(5);