r/SQL • u/Designer-Assist-1354 • Jul 12 '26
Discussion Even a SQL Column Can Traumatize You
I just had my one of those "wait... what?" moments while working on AdventureWorks ( PS: Working on my 2nd Project) At start BusinessEntityID totally confused me, I kept thinking it was just an employee ID.
Then I realized it isn't limited to employees at all. It represents everyone, employees, customers, vendors, salespeople, I mean... wow!
It felt confusing at first, but once it clicked, I realized how smart that database design actually is.
In this project I'm keeping everything raw as much as possible, like i have the database, a notebook, a pen, and me with my mind! now think what you can do! i really love this although I just started so... let's see how well it can go on (On my Data Cleaning Phase)
View all comments
Show parent comment
1
u/burke166 Jul 12 '26
EntityId is unique per entity. Employees and customers are both entities. Both have unique EntityIds. The Entity table would be like this:
Id,Type,Name
1,Employee,John
2,Customer,Mary
3,Customer,Peter
4,Employee,Broomhilda
You _could_ do a composite key of Id and Type and you'd get separate Employee and Customer sequences, but I have no idea why you would ever want to do that. I feel like that way lies peril.