2

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.

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

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

I have designed the table to store the data for both user types on a single user registration table. Now 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.

1
  • 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. Oct 21, 2013 at 6:16

1 Answer 1

4

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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