Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am designing for an ecommerce application, I need to know how to implement the following task.

There are 2 options,

  1. Unregistered Users (Free Listing).
  2. Registered Users.

In this the unregistered users will give all their data but they are not registered with our site.

The registered users will give data and becomes partner with our site.

I have designed the table to store both the data on a single user registration table, but I need to separate both these users, so that I can handle them separately, How to do this? I am expecting some kind of reference / books on enterprise level database design strategies, so that I can learn and understand.

Thanks in advance.

share|improve this question
    
A simple method is simply a bit/flag on the user table whether they're registered or not. I am however curious about the 'unregistered user will give all their data' - and whether that does not mean they're actually registered and the label shouldn't be different - such as "partners" vs. "non-partners"? In which case a simple bit solution makes even more sense. –  Allan S. Hansen Oct 21 '13 at 6:16
    
@Hansen, thanks for your suggestion. –  rathishDBA Oct 21 '13 at 6:25

1 Answer 1

Make a generic table call Users with a unique ID by line (user_id)and put your generic infos (email, password...), used for both Registered and Unregistered users.

Next, create a table "Registered_Users" to store specific info, with a column user_id (which point to Users table : foreign key).

If you want to query just global info about all your users, query :

SELECT ...
FROM Users u

If you want to query your specific info about registered users, query:

SELECT ...
FROM Users u
JOIN Registered_Users re
ON (u.user_id = re.user_id);

Max.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.