Over a million developers have joined DZone.

Relationships and Relational Databases

DZone 's Guide to

Relationships and Relational Databases

· Database Zone ·
Free Resource

When working with relational databases, the join tables are sometimes treated as second class citizens. If they are lucky, they’ll get some additional fields, but are often just placeholder tables connecting your main object tables together. It leads you to think about objects first, and relationships second. With graphs, you will want to switch up your thinking. You want to start thinking about how things are connected. Think about the different ways things are connected. Two people can be friends, co-workers, and neighbors all at the same time.

If you’ve ever been crazy enough to go back to school after your bachelor’s degree, you know all about research papers, journals, and citations. So what kind of relationships can we find here? Papers are rarely authored alone. Having multiple authors means you can create a graph of co-authors. Which students and scientists work together on papers, and which should work together. Scientific research builds upon the work of others, and previous work can be used to build a graph of citations. Keywords in the abstracts or extracted from the papers can be used to build a graph of similar content.

What about a social network like Twitter? How about a Follower graph, a Reply graph, a Mention graph, a Co-Listed graph, a HashTag graph, a Co-Location graph, a Shared-URL graph? What about blogs? How about a Link graph, a Blogroll graph, a Tag graph?

You will be surprised by how connected your data is once you start exploring it. Don’t be afraid of your model. Just start with whatever you have and start adding nodes and relationships as they become apparent to you. Your model will probably evolve, so don’t waste your time second guessing yourself.

When folks ask me about modeling, I tell them to start with the questions they want to answer. It doesn’t end there however. Once you’ve answered those questions, you’ll discover more. You’ll say, if I had this extra piece of data, I could ask and answer a ton new questions I didn’t think about before.

I’ll spend some time in the next few posts digging in a little deeper.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}