#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · DBMS PRACTICE

Candidate Key Finder: Get Keys and Normal Form from Functional Dependencies

Enter a relation and its functional dependencies to find every candidate key.

  • 🔑 All candidate keys
  • ➕ Attribute closure
  • 📐 1NF to BCNF check

How to use the Candidate Key Finder

  1. 1. List the attributesType ABCDE, or names separated by commas such as roll, name, course.
  2. 2. Add dependenciesWrite one functional dependency per line, like BC -> D.
  3. 3. Get the keysSee every candidate key, its closure, prime attributes and normal form.

How the keys are found

A candidate key is a smallest set of attributes whose closure contains every attribute of the relation. The closure X⁺ is found by starting with X and repeatedly adding the right side of any dependency whose left side is already inside.

Two shortcuts make the search fast. An attribute that never appears on the right side of any dependency cannot be worked out from others, so it must be in every key. An attribute that appears only on the right side is never needed in a key. The tool starts from the must-have attributes and adds others in increasing size, skipping any set that already contains a smaller key.

Worked example

Take R(A, B, C, D, E) with A → B, BC → D and D → E. A and C never appear on a right side, so both are in every key. Their closure is: start with {A, C}; A → B adds B; BC → D adds D; D → E adds E. So (AC)⁺ = ABCDE and AC is the only candidate key.

Prime attributes are A and C; B, D and E are non-prime. Because A, only part of the key, decides the non-prime B, there is a partial dependency, so the relation is in 1NF but not 2NF. The tool reports exactly this. The normal-form rules it checks are:

  • 2NF: no non-prime attribute depends on part of a candidate key.
  • 3NF: for each X → A, X is a superkey or A is prime.
  • BCNF: for each non-trivial X → Y, X is a superkey.

Frequently asked questions

What is the difference between a super key and a candidate key?

Any set that determines all attributes is a super key. A candidate key is a super key with nothing extra: remove any attribute and it stops being a key.

Can a relation have more than one candidate key?

Yes. For R(A, B, C) with A → B, B → C and C → A, each of A, B and C is a candidate key.

How do I enter long attribute names?

Separate them with commas in both boxes, for example: roll, course -> grade.

Is the key finder free?

Yes, it costs nothing. You give your name and WhatsApp number once when you see your first answer, then all Uncodemy tools open without asking.

More free tools

See all free tools