what's the difference between those two sql statements to set primary key constraints?
first one:
CREATE TABLE Persons (
ID int NOT NULL,
PRIMARY KEY (ID)
);
second one:
CREATE TABLE Persons (
ID INT NOT NULL ,
constraint pk_Persons primary key (ID)
)
thanks in advance
In the second version, you can give a name to your constraint and you can make primary key with multiple columns, allowing you to drop it using the name instead of having to name every column of a composite constraint.
This is a duplicate question from What is the difference between Primary Key only and Primary Key constraint?