ELI5: Explain Like I'm 5

Candidate key

Imagine you have a lot of different toys in a big toy chest. All of these toys have different characteristics like color, size, and shape.

Now, let's say you wanted to pick a toy but you didn't want to have any duplicates. To do this, you would need to pick a characteristic that is unique to each toy. For example, if you picked the color of the toy as the characteristic, then you would only pick one toy from each color group.

In database terms, this unique characteristic is called a candidate key. It is a way to identify each record in a database in a unique way so that there are no duplicates.

Just like you picked the color trait to identify each toy, in a database, you can choose any combination of traits (or columns) to make a candidate key. It is important to choose the right combination so that the key is unique for each record in the database.

So in short, a candidate key is a set of columns that uniquely identify records in a database, just like choosing a characteristic to uniquely identify each toy in a toy chest.