Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Naming db columns: By business rule or function?

Author  Topic 

waveform
Yak Posting Veteran

93 Posts

Posted - 2014-11-24 : 21:39:43
I'm curious if there is a guideline for this sort of thing:

In an event-management database, there is an Event table with a row for each event. An event can be "closed" - that is, no more registrations allowed for the event. So there is a bit column in the table to flag it as "closed".

I could name this column by the business rule, eg. "EventClosed", or I could name it by the specific function it has in software, eg. "DisallowRegistrations".

What is the usual guideline in that case, if there is one?

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-25 : 09:13:53
It's largely a matter of taste. If it were me, I'd name the column IsClosed with a default value of 0 (which means NOT closed). Set it to 1 when the event closes.

but that's just me
Go to Top of Page

waveform
Yak Posting Veteran

93 Posts

Posted - 2014-11-25 : 09:34:11
Thanks muchly. On the topic of 1's and 0's, would you use a bit type, or tinyint?
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-25 : 10:14:47
If its only 1 and 0, why waste 8 bits? OTOH if its the only bit type, it will take a whole byte
Go to Top of Page
   

- Advertisement -