|
-
Aug 14th, 2012, 05:31 AM
#1
Thread Starter
PowerPoster
What additional tables are required for parents/kids
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?
-
Aug 14th, 2012, 07:28 AM
#2
Re: What additional tables are required for parents/kids
By the sound of things you just needs a Kid table with a foreign key to User.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Aug 14th, 2012, 07:46 AM
#3
Re: What additional tables are required for parents/kids
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
-
Aug 14th, 2012, 10:40 AM
#4
Re: What additional tables are required for parents/kids
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.
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.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|