SQL: Design - Entity Attribute Value Tables (Part 1) - Why?
If you’ve been working with databases for any length of time, you will have come across implementations of Entity-Attribute-Value (EAV) tables (or non-tables as some of my friends would call them).
Instead of storing details of an entity as a standard relational table, rows are stored for each attribute.
For example, let’s create a table of people:
USE tempdb;
GO
DROP TABLE IF EXISTS dbo.StaffMembers;
GO
CREATE TABLE dbo.StaffMembers
(
StaffMemberID int NOT NULL
CONSTRAINT PK_dbo_StaffMembers PRIMARY KEY,
FullName nvarchar(100) NOT NULL,
HairColor nvarchar(20) NULL,
StartDate date NULL,
LoyaltyPoints int NULL
);
GO
INSERT dbo.StaffMembers
(
StaffMemberID, FullName, HairColor, StartDate, LoyaltyPoints
)
VALUES
(1, N'Fred Nurk', N'Blonde', '20250705', 3),
(2, N'Siew Yu Hock', N'Black', '20250709', 2),
(3, N'Abhishek Newma', N'Brown', '20250802', 2);
GO
When we query it, all is as expected:
2026-09-19
