MySQL: AUTO_INCREMENT is awesome

9 Views
Published
#MySQL #tutorial #course

– AUTO_INCREMENT keyword used to automatically create a sequence of a column when inserting data. Applied to a column set as a ‘key’.

CREATE TABLE transactions (
transaction_id INT PRIMARY KEY AUTO_INCREMENT,
amount DECIMAL(5, 2)
);

ALTER TABLE transactions
AUTO_INCREMENT = 1000;
Category
Bro Code
Tags
MySQL tutorial, MySQL course, SQL tutorial
Be the first to comment