AUTO INCREMENT


Auto increment is used to generate an unique number, when a new record is inserted into a table.
The numeric value in AUTO_INCREMENT starts at 1. As records are inserted on the table, the AUTO_INCREMENT value of the given column increases by 1-1.

Syntax :-
column_name data_type AUTO_INCREMENT
Example : Let's how to create AUTO_INCREMENT in table.

Query :

CREATE TABLE my_tab


(


id int NOT NULL AUTO_INCREMENT


name varchar (50),


city varchar (50),


PRIMARY KEY (id)


);

Output :