Why AUTO_INCREMENT does not work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why AUTO_INCREMENT does not work?

ALTER TABLE Employees AUTO_INCREMENT=8 INSERT INTO Employees(firstname,lastname,salary) VALUES ('Greta','Wu',1200) SELECT * FROM Employees ORDER BY id DESC

17th Nov 2023, 1:55 PM
Werg Serium
Werg Serium - avatar
4 Answers
+ 2
You have 3 different statements in your description (ALTER TABLE, INSERT, SELECT). Each statement should end with a ; semicolon.
17th Nov 2023, 5:25 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Ok, i remove the alter table and the auto-increment and everything goes fine. I don't even know why.
17th Nov 2023, 9:01 PM
Werg Serium
Werg Serium - avatar
+ 1
Does the SQL engine report an error? If so, what is the error message?
17th Nov 2023, 4:21 PM
Brian
Brian - avatar
0
It says that the AUTO-INCREMENT should be replaced with "SERIAL" in PostgreSQL or "IDENTITY" in SQL SERVER. This is what says.
17th Nov 2023, 8:52 PM
Werg Serium
Werg Serium - avatar