I am very new to SQL and if my question is silly please forgive my ignorance.
What is the difference between Primary Key only and Primary Key constraint?
Difference between This
CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
PRIMARY KEY (ID, NAME)
and This
CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
CONSTRAINT [Pk_ID_Name] PRIMARY KEY (ID, NAME)
Thank you, Dash
In the second version, you can give a name to your constraint, allowing you to drop it using the name instead of having to name every column of a composite constraint.
Otherwise, they do the same thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With