SQL
6 min read
INTERMEDIATE
Minimal covers: simplify dependency sets without losing meaning
Quick AnswerA minimal cover is an equivalent dependency set with singleton right-hand sides, no extraneous determinant attributes and no redundant dependencies. Equivalent means both sets imply each other, not merely that both match a sample. This lesson uses the singleton convention; some texts merge right-hand sides and call that a canonical cover. Start with G={L→N, C→TI, I→M, LC→S, LC→N, C→M}. Load `fd-enrollment.sql` for two illustrative diagnostics.
Overview
A minimal cover is an equivalent dependency set with singleton right-hand sides, no extraneous determinant attributes and no redundant dependencies. Equivalent means both sets imply each other, not merely that both match a sample. This lesson uses the singleton convention; some texts merge right-hand sides and call that a canonical cover. Start with G={L→N, C→TI, I→M, LC→S, LC→N, C→M}. Load fd-enrollment.sql for two illustrative diagnostics.
First example
sql
SELECT learner_idFROM fd_enrollmentGROUP BY learner_idHAVING COUNT(DISTINCT learner_name)>1ORDER BY learner_id;Observed SQLite result (rows in JSON):
json
[]How it works
- Split C→TI into C→T and C→I. 2. In LC→N, C is extraneous: N belongs to L⁺ under the current set; replace LC→N with L→N and deduplicate. 3. Remove C→M since M is in C⁺ even without that rule (C→I, I→M). The result H={L→N,C→T,C→I,I→M,LC→S}. Neither L nor C alone determines S; no rule in H follows from the others. To check a redundant dependency X→A, compute X⁺ without that dependency; to check a left-side attribute b, compute (X−{b})⁺ with the current set. Repeat reductions and check equivalence in both directions. Minimal covers need not be unique. The SQL diagnostics show L→N and C→I hold in the fixture; they do not prove equivalence. The separate theory checker enumerates all 128 attribute subsets and compares closures.
Practical example
sql
SELECT course_idFROM fd_enrollmentGROUP BY course_idHAVING COUNT(DISTINCT instructor_id)>1ORDER BY course_id;Observed SQLite result (rows in JSON):
json
[]Practice and mistakes
Practice: minimize {A→BC, B→C, AB→D}. One answer is {A→B, B→C, A→D}. Explain why B in AB→D is extraneous and A→C is redundant. Never remove rules based only on sample counts.