0

Is the primary key only meant for rows or is it even for columns

1st Nov 2016, 5:00 PM
Karthik
6 ответов
+ 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.
2nd Nov 2016, 2:12 AM
Tianhao Chen
Tianhao Chen - avatar
+ 1
It is only meant for rows
1st Nov 2016, 5:30 PM
abhishek chaturvedi
abhishek chaturvedi - avatar
+ 1
primary key is for rows to have unique values
2nd Nov 2016, 10:30 PM
Raja Pasupuleti
Raja Pasupuleti - avatar
0
so according to you only rows have unique values is it?
2nd Nov 2016, 2:37 AM
Karthik
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.
2nd Nov 2016, 2:42 AM
Tianhao Chen
Tianhao Chen - avatar
0
And if someone have same FName and LName, that is fine. Because they don't need to be unique.
2nd Nov 2016, 2:43 AM
Tianhao Chen
Tianhao Chen - avatar