A seperate CONSTRAINT line is not required when defining a tables primary key? True or false ?? (SQL SERVER)
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.
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));
Join our real-time social learning platform and learn together with your friends!