From the course: Programming Foundations: Databases

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Keys and unique values

Keys and unique values

- When information is stored in a database, we'll usually want to read or access that data, or part of it, for some particular purpose. Let's say we want to look up a customer's phone number so we can call them about their upcoming reservation. In a table of a few hundred customers, we might have customer names and their phone numbers, and it's pretty simple to ask the database for a customer's information. We could say, give me the record for Taylor Jenkins, and the database would return their row. But what happens when two people have the same name? That's a fairly common problem when dealing with names. If we were to ask the database to give us records matching a name that's shared by a few customers, we'd get back all the records that match. So how do we know which is the correct customer? We certainly wouldn't want to call the wrong person. Unique values allow us to unlock the power that databases provide. In a…

Contents