Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to add an identity column in the SQL server?

1 Answer

0 votes
by (119k points)
edited by

In SQL, Identity column means that the values of that column increment by a certain value for each record. An identity column is used to uniquely identify the records of the table. The following is the syntax to add Identity column in SQL:

IDENTITY (Starting_value, Increment_value)

The user has to initialize the starting value of a column and Increment value which is by default ‘1’.

Here is an example of how to add the identity column in SQL server:

CREATE TABLE Employee (

ID INT IDENTITY (1, 1),

NAME VARCHAR (50)

)

To learn writing SQL queries, you should enroll in this SQL course by Intellipaat to clear the SQL certification exam.

Related questions

Browse Categories

...