If you had to design a database with paid users and trial users would you put them in the same table and differentiate between them with a field? Or would you put them in two separate tables?
Or would you do the best of both worlds and put them in the same table but create two views 1) PaidUsers and 2) TrialUsers
Thanks!
Since your paid users would probably be related to some additional data, but still have the same fieldset as non-paid, the correct way to do this is
[is-a]approach:User
id
username
password
fullname
…
Paiduser
user_id [
fk->User::id]account_id
….
[other addidional data]
EDIT: Now, the trial users will be all records in
Userthat does not have entry inPaiduser. I’m assuming that Paiduser fieldset is a superset of the fieldset of a trial/normal user [User].EDIT 2: To get a list of trial users, which are ‘set difference’ between
UserandPaiduser, the following sql should work: