Last updated on August 8th, 2022 at 11:11 am

The AUTO_INCREMENT attribute can be used to generate a unique identity for new rows:

Here we are creating a simple TABLE named login_details, with olumns ID, uniqid, Manager, email, Account_Name.

AUTO_INCREMENT is assigned to column named ID. By doing this whenever you insert a new row to the table login_details the numerical value within the column ID will get incremented automatically starting with 1 (one) if no value is specified for the ID column.

CREATE TABLE login_details (
     ID MEDIUMINT NOT NULL AUTO_INCREMENT,
     uniqid MEDIUMINT,
     Manager CHAR(30),
     email VARCHAR(255),
     Account_Name VARCHAR(255),
     PRIMARY KEY (id)
) ENGINE=MyISAM;

Leave a Reply

Your email address will not be published. Required fields are marked *