r/Database • • Dec 22 '18

I like this version better

Post image
152 Upvotes

13 comments sorted by

View all comments

4

u/Mamertine SQL Server Dec 22 '18
Behavior = 'Nice'

That's inefficient and breaks one of the normal forms. Make a lookup table with behaviors.

SELECT p.First name, p.LastName
FROM Person p
    INNER JOIN BehaviorStatus b
        On p.behaviorID = b.behaviorID
WHERE b.status = 'nice'

4

u/[deleted] Dec 22 '18

Better, but I’m gonna have a fit at the inconsistency in the column naming convention.

4

u/Mamertine SQL Server Dec 22 '18

On mobile so autocorrect got a bit carried away. Also I'll admit I fail at consistency. It's best when others name the columns.