Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

I’m trying to modify a table to make its primary key column AUTO_INCREMENT after the fact. I have tried the following SQL, but got a syntax error notification.

ALTER TABLE document

ALTER COLUMN document_id AUTO_INCREMENT

Am I doing something wrong or is this not possible?

+--------------------+

| VERSION()          |

+--------------------+

| 5.0.75-0ubuntu10.2 |

+--------------------+

1 Answer

0 votes
by (40.7k points)

Try this code:

ALTER TABLE document MODIFY COLUMN document_id INT auto_increment

Related questions

+2 votes
1 answer
asked Jun 24, 2019 in SQL by Sammy (47.6k points)
0 votes
1 answer

Browse Categories

...