A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

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

  • This Question is Closed
  1. mattfeury
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  2. mattfeury
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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));

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.