Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Related SQL entries

Name: Anonymous 2011-01-15 11:42

I'm trying to make something like an address book using SQL, with SQLite. I want to relate some entries with others. For example, let's say this is my table format:
id name lastname email
And these are some entries I have:
1 John Smith johnsmith@4chan.org
2 Bob Smith bobsmith@4chan.org
3 April Smith aprilsmith@4chan.org

I want to express that John, Bob and April are family. What field could I add to my table prototype so I can then make some query to list entire families? An option is to make a familyid field, but I'm trying to 'point' all the related entries one to another.
Thanks!

Name: Anonymous 2011-01-15 12:04

An option is to make a familyid field
a familyid per entry seems to be the smartest thing to do in this case, you could then create an extra "families" table to store information per family.

i'm not sure what you mean by 'point'ing though, what are you trying to do? if you want to allow entries to be part of multiple families (groups) simply create a { entryid , groupid } table.

Name: Anonymous 2011-01-15 13:07

enjoy your impedance mismatch, bro

Name: Anonymous 2011-01-15 13:55

family(PersonA, PersonB) :- lastname(PersonA) is lastname(PersonB).

Name: Anonymous 2011-01-16 4:43

You should create a familyid field which should be a foreign key to a families table.

Name: Anonymous 2011-01-16 4:50

inb4 you try to add family tree functionality. I did it once, it's ugly as fuck.

You could do relations as a table of (personA, personB) with a constraint that personA < personB. It's ugly and adding a familyID might be the better way to do this.

Name: Anonymous 2011-02-03 0:22

Name: Anonymous 2011-02-04 16:05


Don't change these.
Name: Email:
Entire Thread Thread List