Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialOlolo Olololo
Courses Plus Student 1,816 PointsDid the lecturer forget to add that Unique key can be set on a combination of columns: email AND credit_card_number?
?
1 Answer
Steven Parker
231,184 PointsUnique keys can be set on multiple columns.
You can have more than one unique key column in a table, and a unique key can be composed of more than one column.
As an example of the latter, imagine you had a table of items of different types and each type had serial numbers. The numbers are only unique for a certain type. So neither the type nor the serial number could be used as unique keys in themselves, but a key composed of both a type and serial number would be guaranteed unique.
Hmm, it looks like your question changed after I answered. So if you're just asking why the concept was not introduced in the video, perhaps it will be presented later or in a more advanced course.