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

Pages: 1-

This is how I see marriage

Name: Anonymous 2009-03-04 13:17

humans
- id
- forename
- surname
- birthdate

binary_marriages
- id
- partner_1_id (foreign key references column humans.id)
- partner_2_id (foreign key references column humans.id)
- marriage_date
- divorce_date (NULL if still married)

Name: Anonymous 2009-03-04 13:26

who said romance is dead

Name: Anonymous 2009-03-04 13:29

"Honey, will you add a record to the binary_marriages table with my id as partner_1_id and your id as partner_2_id?"

Name: Anonymous 2009-03-04 13:57

>>3
fuck you, I'm gonna be partner_1_id!

Name: Anonymous 2009-03-04 16:06

http://qntm.org/?gay

Fucking speciesist.

Name: Anonymous 2009-03-04 16:10

This is how I see marriage:

urn:md5:17b3d36785f0ba0f0b8c402211012d8f[1]

References               
1. http://danbooru.donmai.us/post/show/161856/. Retrieved on 2009-03-04. Masturbated on 2007-11-25, 2007-11-28, 2008-02-29, 2008-06-11, 2008-07-12, 2008-07-12, 2008-12-24, 2009-01-13, 2009-03-04

Name: Anonymous 2009-03-04 16:41

Your relational schema fails to reflect the symmetry of the relationship, doesn't account for the death of one or both partners, and makes queries for even simple things like family-in-law difficult.
You'd be well served to start constructing your ontologies in something more suited for the task, like Prolog.

Name: Anonymous 2009-03-04 16:42

id
partner_1_id
partner_2_id

Calling everything blablasomenumber_id is a sure way to confuse the hell out of yourself and/or break things inadvertently. The same applies doubly for just calling a field "id".

Use meaningful field names, such as:
marriage_id
husband_id
wife_id

That both indicates specifically what "id" you're talking about in all three cases, so you don't have to backtrack or draw pictures of your joins when you have a big mess of unwieldy sql referring to the same tables multiple times with different aliases. For example, you might've aliased humans as h1, h2, h3, and h4, and binary_marriages as m1 and m2. It's far too easy in such a scenario to erroneously refer to the wrong column, e.g. h2.id=m1.id. (WHOOPS!) I have seen it happen more than enough times.

You might be able to design your queries properly and pay close attention to the names you pick for your table aliases, but the other guy on your team will inevitably prove himself to be utterly incompetent, and a good, defensive table design can mean all the difference between a well-formed query that works right and a huge fucking mess that takes an hour and ten aspirin to untangle.

Also, in your scenario, there's no specified order for the partner_ids -- so what happens if one person does INSERT INTO binary_marriages (partner_1_id, partner_2_id, marriage_date) VALUES (1848, 3179, '2009-03-04'), and then later on someone else tries to INSERT INTO binary_marriages (partner_1_id, partner_2_id, marriage_date) VALUES (3179, 1848, '2009-03-04'). Now you have two marriages. Best to specify what id is supposed to go where, and use constraints to enforce it. (In the general case, when I have some table joining two individual rows from the same source table, I add a constraint ensuring that something_1_id < something_2_id, or something to that effect.)

Name: Anonymous 2009-03-04 16:46

>>1
I totally agree, Randall.

Name: Anonymous 2009-03-04 16:51

>>8
RTFA

Name: Anonymous 2009-03-04 16:53

>>10
RAFT

Name: Anonymous 2009-03-04 16:53

Instant.dba: Real Men make their own databases.

Name: Anonymous 2009-03-04 18:32

>>8
You're forgetting about gay IHBT >_<.

Name: Anonymous 2009-03-05 7:48

>>1
idiot!


struct human {
 long int     id;
 int          gender; // 0=none, 1=male, 2=female, 3=herm, 4=other
 char *       name;
 }
struct marriage {
 human *      member;
 void *       married_to_this; // set to another marriage struct if married to another human, or NULL if unmarried or already part of existing marriage
 }

Name: Anonymous 2009-03-05 10:27

>>1
humans

>>14
struct human {

Both don't account for situations such as >>6's

Name: Anonymous 2009-03-05 10:39

Both don't account for situations such as:
http://www.foxnews.com/story/0,2933,504125,00.html

Name: Anonymous 2009-03-05 10:52

>>15
Feito-chan is a clone and Nanoha is a devil. I expect a revised data structure in the next two hours or I sue for discrimination and offensive close-mindedness.

Name: Anonymous 2009-03-05 10:53

>>16
Blacks aren't humans. xD

Name: Anonymous 2009-08-16 22:29

Lain.

Name: Anonymous 2010-12-21 5:33

Name: Anonymous 2011-02-03 5:23

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