What is the difference between candidate key and foreign key?

A candidate key is a uniqe key within a table. All unique keys are candidates to be the primary key (primary keys are like the highlander in tables: There can be only one. the other candidates most probably will need to have a unique index when you implement the database).

Foreign keys are keys in one table that relate to primary keys in another.

:-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.