The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

Relationships between Tables in SQL

Relationships between Tables in SQL

Super Learner

Little bit confused as I know that we can have only one primary key per table. I still need to understand why the definition of Primary key mentions (set of columns).

1 Answer

365 Team

Hi Gilles!
Thanks for reaching out.
Yes, a table can have only one primary key. And this key can be composed either by a single column (e.g. customer_id), or by several columns, in which case it will be called a composite primary key. In that case, the uniqueness of the key will not be defined by the value of a single column, but by the combination of the values of several columns. 
As an example of a composite primary key can be considered the combination of the playing card suit (Diamonds, Spades, Clubs, Hearts) and the playing card value (2, 3, 4, …, Jack, Queen, Kind, Ace). Neither the suit nor the value are sufficient to identify a unique value for the playing card. But in combination, the suit and the value can.
Hope this helps.

Complete Data Science Training
Save 60%