Question: I used this script and I created a table CREATE TABLE `employee` ( `id` int(3) NOT NULL AUTO_INCREMENT, `first_name` varchar(20) DEFAULT NULL, `last_name` varchar(20) DEFAULT

I used this script and I created a table

CREATE TABLE `employee` ( `id` int(3) NOT NULL AUTO_INCREMENT, `first_name` varchar(20) DEFAULT NULL, `last_name` varchar(20) DEFAULT NULL, `username` varchar(250) DEFAULT NULL, `password` varchar(20) DEFAULT NULL, `address` varchar(45) DEFAULT NULL, `contact` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

And It suppose to generate unique Primary key for every row and I can insert (first_name,last_name,username,password,address,contact ) for first row but when i tried second I'm getting Duplicate entry '1' for key 'employee.PRIMARY'. I though AUTO_INCREMENT generate unique PK for every row. I would appreciate for help.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!