Identity function
To create a table with Primary Key autoincrement you need to use identity function like in the below example.
Create Table with Primary Key autoincrement
USE tempdb;
GO
create table Research_groups(
id int identity not null primary key,
name varchar(500) not null);
GO
insert into Research_groups(name)
values ('Computer Science'),('Arts'),
('Psychology'),('History') ;
GO
select * from Research_groups;
GO
Results:
| ID | NAME |
|---|---|
| 1 | Computer Science |
| 2 | Arts |
| 3 | Psychology |
| 4 | History |