Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

A seperate CONSTRAINT line is not required when defining a tables primary key? True or false ?? (SQL SERVER)

OpenStudy (mattfeury):

This seems true to me. In my mind, something like this is totally valid: CREATE TABLE user (Email VARCHAR(20) NOT NULL, Name VARCHAR(20) NOT NULL, Password VARCHAR(20) NOT NULL, Primary Key (Email)); 'Constraint' would be optional.

OpenStudy (mattfeury):

Further clarification: the 'Constraint' keyword is optional only if you want to refer to that constraint value by name later. If not, then sql will generate a name for your constraint. This is useful when there are many constraints and you want to modify them individually by name. had I wanted to name the constraint, I could have written that line as: ... Constraint userKey Primary Key (Email));

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!