I've got a table of customers in SQL Server with the information, personal particulars etc. When each user subscribes to this site they'll be because of the choice to opt-directly into 5 various kinds of emails like:

  • If only to get emails about something totally new
  • If only to get the monthly e-newsletter

and so forth. I'm attempting to decide the easiest method to store these details inside a database. My current thinking is to possess a seperate table with 5 posts (one for every opt-in) and also the value as being a bool/bit value.

Because the information will not be needed regularly, it are only needed when you want to send mail to user. What are the possible ways / guidelines for doing something similar to this?

The issue together with your suggested design is it becomes hard to add new email types later on you simply have 5 now, but what goes on whenever you give a sixth or seventh?.

Rather, I'd propose something similar to:

User Table:
UserID (Primary Key)
User Attributes

EmailTemplate Table
EmailTemplateID (Primary key)
Email Template Attributes

UserEmailTemplates
UserID
EmailTemplateID

It is simple to add new templates, and connect all of them with customers.