SQL AUTO INCREMENT

The SQL AUTO INCREMENT field is used to create a numerical PRIMARY KEY value for each additional row of data in a column. By default, AUTO_INCREMENT value will start with "1".

AUTO INCREMENT Syntax

CREATE TABLE table_name (
  column1 datatype   NOT NULL AUTO_INCREMENT,
  colum2 tadatype   NOT NULL,
  ...,
  ...,
  PRIMARY KEY (column1)
);

AUTO INCREMENT Conditions

  • AUTO INCREMENT allows a unique number to be generated automatically when the new record is insert into a table means no need to give a numbering.
  • The starting value for AUTO INCREMENT is "1" by default and when insert a new records then this field will increment by 1 for each new record.
  • We can change the AUTO INCREMENT start sequence use below SQL commond.
ALTER TABLE table_name AUTO_INCREMENT=10;

Policy

GDATAMART.COM is optimized for learning & job information; The users try to improve your knowledge and practical experience through this site but we cannot warrant full correctness of all content... Learn More → | Sitemap →

© 2020 GDATAMART | All Rights Reserved