Hi Guys,
I have a shopping website. There is a user table(userid, password, name) etc. The client now wants each user to have a profile where they can add their kids.
What other tables do I need to make this work?
Printable View
Hi Guys,
I have a shopping website. There is a user table(userid, password, name) etc. The client now wants each user to have a profile where they can add their kids.
What other tables do I need to make this work?
By the sound of things you just needs a Kid table with a foreign key to User.
or use the same table... with ParentID as an FKey back to itself. Then you could have a Type field that indicates if it's a Parent (0) or a child (1) record.... actually, you don't even need that... if the ParentID is 0 or NULL then it's a parent record... if it has a value, then you know it's a kid record.
-tg
Actually that's probably a better idea than mine. Apart from anything it'll let you recurse through a whole chain of kids, grand-kids, great grand kids etc.Quote:
or use the same table
About the only argument I could come up with against TG's aproach would be if kids AREN'T users, in which case you probably need to separate the concept of a person from a user. After all, it's a person that has kids, not a user.