This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques and have Mario Casciaro & Luciano Mammino on-line!
See this thread for details.
Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Question on database design: It's really a hierarchical design

 
Ranch Hand
Posts: 161
1
jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following is the question asked in stackoverflow.com :

Can any one help me designing the database for heirarchical organization. Client requirements are : I have multiple organizations and there is a super admin for all of the organizations who can create, update or delete organizations. Each organization has features (apps) . These features apps are going to be used by the employees in the organization.

A super admin creates an organization admin and sets features for organization. The features (or apps in the organization) are different from organization to organization. Admin of the organization can create sub admins under him and in turn sub admins can create employees under them. When an employee logs in he can see only his page and he can contact his immediate admin and also the super admin.

When an admin logs in , he should be able to see his page and also sub-admins page as well as employees too and he has right to create , update and delete employees under him.

Could you please throw light on the database design for the above described. I am thinking of using emaild id as the primary key for each employee or admin or subadmin.

I am very poor at database designing concepts. I am learning database designs and in search, i found this question recently. Is there any good book for database design (practical examples)
 
Marshal
Posts: 3655
516
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SO post: Mysql and hibernate
 
Swapna latha
Ranch Hand
Posts: 161
1
jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:SO post: Mysql and hibernate


After reading the question in stackoverflow, what is my thought is that parent table id goes to child table, child talbe id goes to subchild and it goes on. I think its a simple design, but i am not sure of. Curious to learn about database design techniques and some practical exercises
 
Swapna latha
Ranch Hand
Posts: 161
1
jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Swapna latha wrote:

Ron McLeod wrote:SO post: Mysql and hibernate


After reading the question in stackoverflow, what is my thought is that parent table id goes to child table, child talbe id goes to subchild and it goes on. I think its a simple design, but i am not sure of. Curious to learn about database design techniques and some practical exercises


Is the answer right ?
 
Saloon Keeper
Posts: 24330
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, there's an entirely different way to do this kind of stuff. Node-relational non-SQL databases such as Neo4J are good for when the relationships are more important than data details.

You can certainly build an organizational structure on top of a SQL database, but Neo4J shines when you need to pay attention to not only the hierarchical (and for that matter, lateral) relationships, but want to define specific relationship types.

Neo4J is one of the persistent data platforms supported by Spring Data, if you're a Spring fan.

Fair warning: the Neo4J query language can look pretty odd if you're used to SQL, but it's actually a fun database to work with.

I did a little project that was intended to allow the JavaRanch bartenders to bid on what forums they wanted to moderate - we used to put them all up for "dibs" with priority for our latest recruits, so Neo4J allowed easy pairing of people to forums with additional attributes like "first choice", "second choice", "priority person" and so forth. I never finished it and we use a different system now, but it was entertaining to design.
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic