JeremyRenner2
JeremyRenner2

Reputation: 61

Modifying a primary key to auto-increment from a set value

I have the following MYSQL statement:

ALTER TABLE students MODIFY studentID INTEGER NOT NULL AUTO_INCREMENT = 20;

StudentID already exists and is primary key. I want to edit it to autoincrement from 20. However, I am getting a red line on the equals sign in mySQL Workbench and the message

= is not valid in this position, expecting EOF.

What am I doing wrong?

Upvotes: 0

Views: 572

Answers (1)

GMB
GMB

Reputation: 222402

I think you want:

ALTER TABLE students AUTO_INCREMENT = 20;

Upvotes: 1

Related Questions