MySQL Forums
Forum List  »  Newbie

Re: advice on queries
Posted by: Peter Brawley
Date: September 22, 2016 11:03AM

Generally, you're trying to model a network in a relational database. Doable, but very difficult.

When data describes a social network, or a family tree, or a bill of materials, hierarchical depth depends on the data. You no longer know how many Joins will be needed to walk the network. You may need a different data model: the graph, about which you may wih to read a little (https://en.wikipedia.org/wiki/Graph_database). Also about network databases (https://en.wikipedia.org/wiki/Network_model).

There's an example relational schema of a social network at http://www.databaseanswers.org/data_models/social_networking/index.htm. If you decide ti stick with relational, that might be a place to start.

> if these tables would work for this output

That's the key question in relational database design. The only way to find out is to try to write the queries, and modify the schema as you go. I'm very suspicious about ...

p_id1 int(11) NOT NULL,
p_id2 int(11) NOT NULL,
o_id1 int(11) NOT NULL,
o_id2 int(11) NOT NULL,

but it's premature to quibble about details.

Options: ReplyQuote


Subject
Written By
Posted
September 21, 2016 08:22PM
Re: advice on queries
September 22, 2016 11:03AM
September 22, 2016 04:09PM
September 22, 2016 04:11PM
September 22, 2016 06:37PM
September 22, 2016 06:56PM
September 22, 2016 08:37PM
September 22, 2016 08:49PM
September 23, 2016 08:37AM
September 23, 2016 09:25AM
September 22, 2016 08:53PM
September 22, 2016 04:12PM
September 22, 2016 04:49PM
September 22, 2016 04:53PM
September 23, 2016 04:00AM
September 23, 2016 09:30AM
September 23, 2016 12:40PM
September 23, 2016 12:42PM
September 23, 2016 12:58PM
September 26, 2016 04:05AM
September 23, 2016 12:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.