ToolSphere

Attribute Closure Calculator

Computer science

Compute the attribute closure X+ under functional dependencies for relational database design. Verify superkeys and determine candidate key memberships.

Attribute closure calculator

Work out X⁺ from a set of functional dependencies, and see whether X is a superkey. Write one dependency per line as A,B -> C. Single letters may be written together, as in AB -> C.

Closure

A+ = { A, B, C }

It determines every attribute, so A is a superkey.

Candidate keys

A

Relation:
R(A, B, C)
Prime:
A
Non-prime:
B, C
In every key:
A

Highest normal form: 2NF

DependencyBreaksWhy
B → C3NFB is not a superkey and determines the non-prime C — a transitive dependency.

On this browser only

Give feedback

Did this tool help?

Tell us what worked, what didn’t, or what you’d like next.

Opens Google Forms in a new tab with this tool’s name filled in. No sign-in or email required. Feedback is optional.

How to use Attribute Closure Calculator

  1. 1Enter the functional dependencies, one per line, as A,B -> C.
  2. 2Enter the attribute set X whose closure you want.
  3. 3Read X+ and whether it determines every attribute, which makes it a superkey.
  4. 4Add any attribute that appears in no dependency in the extra attributes box.

About Attribute Closure Calculator

Attribute Closure Calculator

Computes X⁺, the set of every attribute determined by X under a set of functional dependencies. Almost every other question in normalisation is answered by running this one operation in different places.

How the closure is built

Start with X itself. Scan the dependencies: whenever the whole left side of a dependency is already inside the set, add its right side. Repeat until a full pass adds nothing. The order of scanning never changes the answer — the closure is unique.

The part people get wrong is compound determinants. For AB → C, having A is not enough: the closure only grows if both A and B are already in the set. A dependency you cannot use yet may become usable after a later one fires, which is why the scan repeats.

What the closure tells you

Superkey: if X⁺ contains every attribute of the relation, X is a superkey.

Candidate key: a superkey where no proper subset is also a superkey. Drop one attribute at a time and recompute; if some smaller set still determines everything, X was not minimal.

Whether a dependency is implied: X → Y holds under your set if and only if Y is inside X⁺. That is the practical test for redundant dependencies, and the basis for finding a minimal cover.

Naming your attributes

Single-letter shorthand is understood, so AB → C means two attributes on the left. Real column names work too — write student_id, name — and once anything lowercase or underscored appears, nothing is split apart. That rule is per grammar, not per word, so a column called "name" is never read as N, A, M, E.

Attributes that appear in no dependency

An attribute mentioned nowhere in the dependency list is still part of the relation, and it changes the answer: it belongs to every candidate key, because nothing else can determine it. Put those in the extra attributes box or the keys will come out wrong.

Guides and tutorials

Frequently asked questions

What does X+ actually mean?

It is every attribute that X determines, directly or through a chain of dependencies. If A -> B and B -> C, then A+ is {A, B, C}: A determines C even though no dependency says so directly.

How do I tell whether X is a candidate key?

First, X+ must contain every attribute, making X a superkey. Then it must be minimal: remove one attribute at a time and recompute the closure. If any smaller set still determines everything, X is a superkey but not a candidate key.

Why didn't AB -> C fire when my set contains A?

A compound determinant needs its whole left side present. AB -> C only applies once both A and B are in the set. This is the most common mistake in closure working, and it is why the algorithm keeps rescanning until a pass adds nothing new.

Does the order I apply the dependencies in change the result?

No. The closure is unique regardless of the order you scan in, which is what makes it a reliable exam answer. Different orders may reach it in different numbers of steps, but the final set is identical.

How do I check whether a dependency is redundant?

To test whether X -> Y is implied by the rest, remove it, then compute X+ using only the remaining dependencies. If Y is still inside X+, the dependency added nothing and is redundant.

Have a suggestion for Attribute Closure Calculator?Share your feedback ↗