Database Structure Newsletter Subscription

Posted on 2009-04-16
Last Modified: 2012-05-06
I am have an issue when designing a newsletter subscription table.
Here's the problem.

I am trying to store for all my customers the newsletters they have subscribed / unsubscribed to. I have two possible solutions, none of which are too elegant.

1. Add columns to my Customer table one for each newsletter, each column being a BIT. 1 for subscribed, 0 for unsubscribed. However everytime I add a new newsletter I will have to add a new column to this table.

2. Have a Newsletter table which has all the newsletters. Then have an associative entity which links the customer table to the newsletter table and an attribute on this associative entity which states whether the customer has subscribed or unsubscribed. However, the problem here is that everytime I create a new newsletter I have to add a new row to the table for each customer signalling if we are subscribing or unsubscribing them by default.

Anyone got any better solutions?
Question by:booktopia
    LVL 13

    Expert Comment

    Take a look at this:

    They have  a script to generate a MySQL db, if you can get your hands on MySQL db to view the database structure.

    Otherwise i always use a third party software like Constant Contact.
    LVL 28

    Accepted Solution

    Simplify the problem a bit.  You have a Newsletters table.  You have a Customer table.  Why keep track of "unsubscribed" newsletters?

    Just build a new table "Subscriptions" which contains a foreign key to Customer and another to Newsletter, along with any other data about the subscription, such as date started.  This would keep your data in 3NF.  Findind subscriptions is easy, and finding "non-subscriptions" for a customer is still possible with NOT IN.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article describes some very basic things about SQL Server filegroups.
    SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now