1CREATE TABLE Persons (
2 Personid int NOT NULL AUTO_INCREMENT,
3 LastName varchar(255) NOT NULL,
4 FirstName varchar(255),
5 Age int,
6 PRIMARY KEY (Personid)
7);
8INSERT INTO Persons (FirstName,LastName)
9VALUES ('Lars','Monsen');
1CREATE TABLE table_name (
2 id INT NOT NULL IDENTITY(1, 1),
3 name NVARCHAR (100) NULL,
4 school NVARCHAR (100) NULL,
5 PRIMARY KEY (ID)
6);
1Autoincrement keyword allows the
2user to create a unique number to get
3generated whenever a new record is
4inserted into the table.
5This keyword is usually required
6whenever PRIMARY KEY in SQL is used.
1
2INSERT INTO Persons (Personid,FirstName,LastName)
3
4VALUES (seq_person.nextval,'Lars','Monsen');