You are on page 1of 5

Database design - Members & companies represented by members - Database Administrators Stack Exchange

Search on Database Administrators…


Database Administrators Stack Exchange is a
question and answer site for database
professionals who wish to improve their database
skills and learn from others in the community. It
only takes a minute to sign up.

Sign up to join this community

Anybody can ask a question


Anybody can answer

The best answers are voted up and rise to


the top

Database design - Members & companies represented by members


Home

Questions
Ask Question
Tags
Asked
5 months ago
Users
Active
5 months ago

Unanswered
Viewed
71 times

Blog
2

I'm struggling in database design problem and it seems I can't get it out properly. Ben Popper is the worst coder in the world:
Something awry with my array
I need some help
By on this.
using Maybe
our site, it's a dumb
you acknowledge thatcase butread
you have I'd and
likeunderstand
to validate or correct
our Cookie Policy, my scheme
Privacy and
Policy, and ourthen
Termsgo
of Service.
ahead.
This week, #StackOverflowKnows fast planes,
The app should behave like this: math with dates, and code comments

a user can be part of multiple accounts and have different roles (admin or not) Featured on Meta
an account can have one or many groups
each group can have one or many members
TLS 1.0 and TLS 1.1 removal for Stack
a member can be part of many groups Exchange services
a member can be either an user or a legal entity (company)
Related
if it's a company, then the company is represented by a user
a user can represent 0,1 or many companies in different groups
6
Here is my actuel scheme where I have a n-to-m relationship on Groups-User-Companies.

How to use a relational database to store all users


who belong to a group, and all groups which a user
belongs to?

1
How does this database design look?

https://dba.stackexchange.com/questions/246884/database-design-members-companies-represented-by-members/246911#246911[2/15/2020 6:27:56 AM]


Database design - Members & companies represented by members - Database Administrators Stack Exchange

0
is this database structure correct?

12

Modeling a scenario in which each Music Artist is


either a Group or a Solo Performer

1
Database design for 2 1-to-many?

Table design for “Users & Groups” plus “Groups


within Groups”

2
Is my DB design alright or not?

Creating and querying a database to set


hierarchical associations between Groups, Users,
Items and Points

Schema for stores and groups of stores and


Here in GroupMembers, the users_id or companies _id will be filled either it's a legal entity or individual. companies

And the CompanyRepresentedBy table will contain the group_id, user_id and company_id Hot Network Questions
I'm not really sure of this scheme. Does coiling and straightening a wire change its
resistance?
To have a better understanding, here is a diagram of the relationship Account-Group-Member-User

Providing the spymaster with cues for clues in


Codenames

How to solve this probability problem analytically


(instead of using simulation)? Probability of Bill
wins the game if he goes first

A special chemical compound with a touch of math

Truncate partitioned table with values from


partitioned column?

Why can't Ditto copy eyes properly?

Advantages of Pallier vs Goldwasser-Micali

In the UK parliament, how much of Prime


Minister's Questions is pre-planned?

What is the Dorfman method in chess?

Answer templating

When Was The Gospel of Luke Written?

Is going to Ceres "as easy as going to Mars" like


this aerospace engineer says?

create empty img with dd so that it its sectors are


of 4096bytes rather than 512

Why is the Fourier transform so ubiquitous?

Implicit differentiation becoming ineffective

How can Michael Bloomberg become the


Democratic nominee for President when he has

https://dba.stackexchange.com/questions/246884/database-design-members-companies-represented-by-members/246911#246911[2/15/2020 6:27:56 AM]


Database design - Members & companies represented by members - Database Administrators Stack Exchange

not appeared on any primary ballot so far?

How to use gas pump in Israel?

Integer Logarithm

How should the ESTA question "Have you ever


been issued a passport or ID for travel by any
other country?" be understood?
Thank you all!
What does "Manistan" mean?

PS: I can provide the MySQL Workbench file if needed Light task-processing systems with zero
dependency for Linux systems
database-design
Product Owner and Scrum Master role during
standup
share improve this question What happens if you can't pay at an auction?

edited Sep 4 '19 at 12:15 Is 'to resign' an object or subject complement in


'The teacher wishes to resign'?

Question feed
asked Sep 3 '19 at 17:03

Bidibule
21 2
add a comment

1 Answer active oldest votes

Why would you split into User and Account?

What is Group standing for? It's relating to Account and Company now, that I'm thinking to GroupType or
separated tables AccountGroup and CompanyGroup

Above all, based on your current requirements, following my suggestions:

https://dbdiagram.io/d/5d6f2704ced98361d6de2d0d

a user can be part of multiple accounts and have different roles (admin or not)

Tables: User (Id), Account (Id) and UserAccount (UserId, AccountId)

https://dba.stackexchange.com/questions/246884/database-design-members-companies-represented-by-members/246911#246911[2/15/2020 6:27:56 AM]


Database design - Members & companies represented by members - Database Administrators Stack Exchange

an account can have one or many groups

Tables: Group (Id) and AccountGroup (AccountId, GroupId)

each group can have one or many members / a member can be part of many groups

Tables: Member (Id) and MemberGroup (MemberId, GroupId)

a member can be either an user or a legal entity (company)

Tables: Company (Id, MemberId), User (add MemberId)

if it's a company, then the company is represented by a user / a user can represent 0,1 or many
companies in different groups

Tables: Company (add RepresentUserId), Group (add RepresentUserId)

Please noted that this is for an idea, not a fullfill solution. I hope this help you much.
share improve this answer

answered Sep 4 '19 at 3:31

Dat Nguyen
126 7

Thanks for the reply Dan. A group is just grouping members. See it like departments. An account can have multiple groups
and groups have members (which can be a company represented by a user OR a user). I can't use the relationship User
(MemberId) and Company(id, MemberId) nor Company (RepresentUserId) because it means company will have just on
representative only but in fact the company could be in 2 separate accounts and groups with different representatives. See
my updated diagram in the first post for a better understanding
–  Bidibule
Sep 4 '19 at 12:17

add a comment

Your Answer

Sign up or log in
Sign up using Google
Sign up using Facebook

Sign up using Email and Password

Post as a guest
Name

Email
Required, but never shown

Post
Post Your
Your Answer
Answer

https://dba.stackexchange.com/questions/246884/database-design-members-companies-represented-by-members/246911#246911[2/15/2020 6:27:56 AM]


Database design - Members & companies represented by members - Database Administrators Stack Exchange

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged database-design or ask your own
question.

DATABASE ADMINISTRATORS

Tour

Help

Chat

Contact

Feedback

Mobile

Disable Responsiveness

COMPANY

Stack Overflow

Stack Overflow Business

Developer Jobs

About

Press

Legal

Privacy Policy

STACK EXCHANGE
NETWORK

Technology

Life / Arts

Culture / Recreation

Science

Other

Blog

Facebook
Twitter

LinkedIn
site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0
with attribution required.
rev 2020.2.13.36069

https://dba.stackexchange.com/questions/246884/database-design-members-companies-represented-by-members/246911#246911[2/15/2020 6:27:56 AM]

You might also like