0
Is the primary key only meant for rows or is it even for columns
6 Antworten
+ 2
It is for rows only. In each table, you will have at list one column that all its rows must have no duplicated value.
For example, you have a column named "student_id", and each rows in this column must be unique/non-duplicated.
Why not columns? Well, that is because each row contains different information. For example, your "mailing_address" and "billing_address" could be the same although they are different columns.
+ 1
It is only meant for rows
+ 1
primary key is for rows to have unique values
0
so according to you only rows have unique values is it?
0
Well, each row contains a series of information. For example, SSN, LName, FName. Those are 3 columns and you have 5 rows, for example.
Your primary key is SSN. That is, you can have 5 people under the exactly same name but with different SSN. And you are using SSN to differenciate which person you are referring to.
0
And if someone have same FName and LName, that is fine. Because they don't need to be unique.