+ 1
In SQL, is it a must I indicate a primary key? Can't my first column which has int as datatype be the primary key by default?
Database
3 ответов
+ 5
Yes, pk is required. But pk is a combination of NOT NULL and UNIQUE. So a email address can be a pk, too. Check the sl course for the full sytax of relation declaration.
+ 3
You're welcome
CREATE TABLE Users
(
UserID int,
FirstName varchar(100),
LastName varchar(100),
City varchar(100),
PRIMARY KEY(UserID)
);
+ 1
Thanks