Computer Science/Database

W3Schools SQL | #51 SQL AUTO INCREMENT 필드

토마토. 2022. 10. 30. 00:05

SQL AUTO INCREMENT Field

AUTO INCREMENT Field

새로운 record에 대해 unique numer를 부여하는 field

Syntax for SQL SERVER

CREATE TABLE Persons (
    Personid int IDENTITY(1, 1) PRIMARY KEY,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int
);
INSERT INTO Persons (FirstName, LastName)
VALUES ('Lars', 'Monsen');