In the Week 8 shorts, Mr. Lloyd is talking about a set of Seinfeld related tables. The first has a primary key but the second does not. I was under the impression that every table needed to include keys, am I wrong about that?
Thanks
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.
Sign up to join this communityYes, you are wrong. But it's not an unreasonable assumption.
A Primary Key is literally the primary restriction on data of a table. It puts restrictions on duplicate data on the table.
But there's nothing that says that there needs to be any kind of restrictions on duplicate data. You can create a table with no keys whatsoever, and allow unlimited duplicate data. Even then, it is still allowable to put an index on that table.
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)