What is a functional dependency?
A functional dependency X -> Y says that a value of X determines the value of Y: any two rows that agree on X also agree on Y. X is the determinant. A primary key determines every column of its table, which is what makes it a key; but a dependency can also hold between two columns that are not keys at all.
Take a small hospital, a cut-down hospital management system. Patients are admitted under a doctor, and each doctor works in one department. In this first design the department lives on the doctor’s row:
CREATE TABLE dbo.Patient ( PatientId int NOT NULL CONSTRAINT PK_Patient PRIMARY KEY, FullName nvarchar(200) NOT NULL ); CREATE TABLE dbo.Doctor ( DoctorId int NOT NULL CONSTRAINT PK_Doctor PRIMARY KEY, FullName nvarchar(200) NOT NULL, DepartmentId int NOT NULL, DepartmentName nvarchar(100) NOT NULL ); CREATE TABLE dbo.Admission ( AdmissionId int NOT NULL CONSTRAINT PK_Admission PRIMARY KEY, PatientId int NOT NULL, DoctorId int NOT NULL, AdmittedAt datetime2(0) NOT NULL, CONSTRAINT FK_Admission_Patient_PatientId FOREIGN KEY (PatientId) REFERENCES dbo.Patient (PatientId), CONSTRAINT FK_Admission_Doctor_DoctorId FOREIGN KEY (DoctorId) REFERENCES dbo.Doctor (DoctorId) );

The dependencies of dbo.Doctor, written as the hospital’s rules:
DoctorId -> FullName: a doctor has one name.DoctorId -> DepartmentId: a doctor works in one department.DepartmentId -> DepartmentName: a department has one name.
The first two have the primary key on the left, and PK_Doctor keeps them true: there is one row per DoctorId, so one name and one department per doctor. The third has an ordinary column on the left, and SQL Server knows nothing about it. A dependency is a rule of the world the table describes, and SQL Server enforces it only through what you declare for it: a primary key or unique constraint on its determinant, or a composite foreign key that copies the pair from a table where it is unique.
What is a transitive dependency?
A transitive dependency is a functional dependency A -> C that holds only because A -> B and B -> C, where B doesn’t determine A. In a table, it is a non-key column that depends on another non-key column instead of on the primary key directly.
dbo.Doctor has one. DoctorId -> DepartmentId and DepartmentId -> DepartmentName, so DoctorId -> DepartmentName, but only by way of the department. DepartmentId doesn’t determine DoctorId: department 3 has two doctors. The last condition leaves out keys: if B determined A, B would be a key in its own right, and the chain would be two keys naming the same row.
FullName is not transitive. It depends on DoctorId directly; there is no column in between. The test for each non-key column is the same question: does it describe the row’s key, or does it describe some other column in the row? DepartmentName describes the department, so it fails.
What goes wrong: update, insert and delete anomalies
The department’s name is stored once per doctor, so every fact about a department exists as many times as it has doctors. Three doctors go in, two in Cardiology. Then the department is renamed, but the update touches only the first doctor’s row:
INSERT INTO dbo.Doctor (DoctorId, FullName, DepartmentId, DepartmentName) VALUES (1, N'Dr. Amara Okafor', 3, N'Cardiology'), (2, N'Dr. Jonas Weber', 3, N'Cardiology'), (3, N'Dr. Priya Nair', 5, N'Neurology'); UPDATE dbo.Doctor SET DepartmentName = N'Heart Center' WHERE DoctorId = 1; SELECT DepartmentId, COUNT(DISTINCT DepartmentName) AS Names FROM dbo.Doctor GROUP BY DepartmentId HAVING COUNT(DISTINCT DepartmentName) > 1;
All three statements succeed. The SELECT is the test for a functional dependency on stored data: group by the determinant and count the distinct values of the dependent column. It returns department 3 with 2 names, “Heart Center” and “Cardiology”. The rule DepartmentId -> DepartmentName is now false in the table, and nothing complained. That is the update anomaly: a change to one fact has to reach many rows, and a missed row is a contradiction.
The insert anomaly is the department that has no doctors yet. Oncology opens before anyone is hired, and its only place is a doctor’s row:
INSERT INTO dbo.Doctor (DepartmentId, DepartmentName) VALUES (7, N'Oncology');
Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column 'DoctorId', table 'Hospital.dbo.Doctor'; column does not allow nulls. INSERT fails.
The statement has been terminated.A row needs a doctor before it can hold a department. The delete anomaly is the reverse: Dr. Priya Nair is Neurology’s only doctor, so deleting her row deletes the fact that department 5 is called Neurology.
How 3NF removes a transitive dependency
A table is in third normal form (3NF) when it is in second normal form and no non-key column depends on the primary key transitively. Put formally, for every functional dependency X -> Y that holds, with Y not part of X, X is a super key or each column of Y is part of a candidate key. Second normal form handles partial dependencies, columns that depend on only part of a composite key; third normal form handles the chains. Database normalization walks through all the forms in order.
The fix is a decomposition. The middle column, the determinant B, becomes the primary key of a table of its own, and the columns that depend on it move there. The original table keeps B as a foreign key. This script replaces the first dbo.Doctor; dbo.Patient and dbo.Admission stay as they were:
CREATE TABLE dbo.Department ( DepartmentId int NOT NULL CONSTRAINT PK_Department PRIMARY KEY, Name nvarchar(100) NOT NULL CONSTRAINT AK_Department_Name UNIQUE ); CREATE TABLE dbo.Doctor ( DoctorId int NOT NULL CONSTRAINT PK_Doctor PRIMARY KEY, FullName nvarchar(200) NOT NULL, DepartmentId int NOT NULL, CONSTRAINT FK_Doctor_Department_DepartmentId FOREIGN KEY (DepartmentId) REFERENCES dbo.Department (DepartmentId) );

DepartmentId -> Name now has a primary key on the left, so PK_Department enforces it. AK_Department_Name enforces the other direction, one department per name. Nothing was lost: a doctor’s department name is a join away, through the line from dbo.Doctor to dbo.Department. The same rows again:
INSERT INTO dbo.Department (DepartmentId, Name) VALUES (3, N'Cardiology'), (5, N'Neurology'), (7, N'Oncology'); INSERT INTO dbo.Doctor (DoctorId, FullName, DepartmentId) VALUES (1, N'Dr. Amara Okafor', 3), (2, N'Dr. Jonas Weber', 3), (3, N'Dr. Priya Nair', 5); UPDATE dbo.Department SET Name = N'Heart Center' WHERE DepartmentId = 3; INSERT INTO dbo.Doctor (DoctorId, FullName, DepartmentId) VALUES (4, N'Dr. Lena Ruiz', 9);
Msg 547, Level 16, State 1, Line 10
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Doctor_Department_DepartmentId". The conflict occurred in database "Hospital", table "dbo.Department", column 'DepartmentId'.
The statement has been terminated.The rename is one row, and both cardiologists see “Heart Center”. Oncology is stored with no doctors. Dr. Priya Nair can leave without taking Neurology’s name with her. And the last insert, a doctor in department 9, is refused with Msg 547: there is no department 9. The flat table would have taken it with any name you typed.
Is every repeated column a transitive dependency?
No. A column is transitive only if the rule says it follows from another non-key column. The data can disprove a dependency, as the SELECT above did, but it can never prove one: three tidy rows don’t make a rule.
Say the hospital wants each admission’s department on the admission:
ALTER TABLE dbo.Admission ADD DepartmentId int NOT NULL; ALTER TABLE dbo.Admission ADD CONSTRAINT FK_Admission_Department_DepartmentId FOREIGN KEY (DepartmentId) REFERENCES dbo.Department (DepartmentId);

If the rule is “an admission belongs to its doctor’s department”, then AdmissionId -> DoctorId -> DepartmentId, and Admission.DepartmentId is a transitive dependency. It repeats what dbo.Doctor already says, and it goes stale the day Dr. Jonas Weber moves to Neurology. Drop it and join through the doctor.
If the rule is “the department the patient was admitted to”, the column is a fact of the admission. A cardiologist can treat a patient on the neurology ward, and an admission from last year should keep last year’s department after the doctor moves. Here DoctorId doesn’t determine DepartmentId, so there is no chain, and the table is in 3NF with the column in it. The same goes for any value copied at a moment in time, like a price paid or an address shipped to.
How ERDsmith helps
Every anomaly above was decided while the tables were still empty: a department described on a doctor’s row, with no table to hold it. On a diagram that shape is visible early, a determinant column with no line and its dependent columns sitting beside it. In ERDsmith the fix is a new box and one relationship:
- Drawing the relationship from
dbo.Departmenttodbo.Doctorfinds theDepartmentIdthe flat table already had: a migrated column joins an existing child column of the same name and type, so it becomes the foreign key instead of getting a twin. - Had that column another type, say
smallintagainst the department’sint, you are asked to choose: a role name for the new column, or a rename of the old one. The clash is settled before a single row moves.