Skip to main content
added 2 characters in body
Source Link
András Váczi
  • 31.8k
  • 13
  • 103
  • 152

I'm designing a database for contacts and I'm looking for some feedback on the current design.

What iI want:

  • A contact can be a person or an organization.
  • A contact can have many groups.
  • A contact can have many emails and addresses
  • A contact can have one organization (employed)
  • AAn organization can have many contacts (employees)
  • A group can have many contacts.

What iI have:

  • Contact(Id, PersonId (FK), OrganizationId (FK), EmployerId (FK, self reference))
  • Person(Id, FirstName, LastName, Birthday)
  • Organization(Id, Name, Founded)
  • Group(Id, Name)
  • ContactGroup(Id, ContactId (FK), GroupId (FK))
  • Email(Id, ContactId (FK), Name)
  • Address(Id, ContactId (FK), Street, City, ZipCode, Country)

What bothers me the most is that the contact entity has one organization or one person, and also a self reference (EmployerId) if aan organization has employees (which are also contact entities) and vice versa.

enter image description here

Is this a problem or see you a better way?

I'm designing a database for contacts and I'm looking for some feedback on the current design.

What i want:

  • A contact can be a person or an organization.
  • A contact can have many groups.
  • A contact can have many emails and addresses
  • A contact can have one organization (employed)
  • A organization can have many contacts (employees)
  • A group can have many contacts.

What i have:

  • Contact(Id, PersonId (FK), OrganizationId (FK), EmployerId (FK, self reference))
  • Person(Id, FirstName, LastName, Birthday)
  • Organization(Id, Name, Founded)
  • Group(Id, Name)
  • ContactGroup(Id, ContactId (FK), GroupId (FK))
  • Email(Id, ContactId (FK), Name)
  • Address(Id, ContactId (FK), Street, City, ZipCode, Country)

What bothers me the most is that the contact entity has one organization or one person, and also a self reference (EmployerId) if a organization has employees (which are also contact entities) and vice versa.

enter image description here

Is this a problem or see you a better way?

I'm designing a database for contacts and I'm looking for some feedback on the current design.

What I want:

  • A contact can be a person or an organization.
  • A contact can have many groups.
  • A contact can have many emails and addresses
  • A contact can have one organization (employed)
  • An organization can have many contacts (employees)
  • A group can have many contacts.

What I have:

  • Contact(Id, PersonId (FK), OrganizationId (FK), EmployerId (FK, self reference))
  • Person(Id, FirstName, LastName, Birthday)
  • Organization(Id, Name, Founded)
  • Group(Id, Name)
  • ContactGroup(Id, ContactId (FK), GroupId (FK))
  • Email(Id, ContactId (FK), Name)
  • Address(Id, ContactId (FK), Street, City, ZipCode, Country)

What bothers me the most is that the contact entity has one organization or one person, and also a self reference (EmployerId) if an organization has employees (which are also contact entities) and vice versa.

enter image description here

Is this a problem or see you a better way?

Embed image
Source Link
Jon Seigel
  • 16.9k
  • 6
  • 46
  • 86

I'm designing a database for contacts and I'm looking for some feedback on the current design.

What i want:

  • A contact can be a person or an organization.
  • A contact can have many groups.
  • A contact can have many emails and addresses
  • A contact can have one organization (employed)
  • A organization can have many contacts (employees)
  • A group can have many contacts.

What i have:

  • Contact(Id, PersonId (FK), OrganizationId (FK), EmployerId (FK, self reference))
  • Person(Id, FirstName, LastName, Birthday)
  • Organization(Id, Name, Founded)
  • Group(Id, Name)
  • ContactGroup(Id, ContactId (FK), GroupId (FK))
  • Email(Id, ContactId (FK), Name)
  • Address(Id, ContactId (FK), Street, City, ZipCode, Country)

What bothers me the most is that the contact entity has one organization or one person, and also a self reference (EmployerId) if a organization has employees (which are also contact entities) and vice versa.

Database design, Full sizeenter image description here

Is this a problem or see you a better way?

I'm designing a database for contacts and I'm looking for some feedback on the current design.

What i want:

  • A contact can be a person or an organization.
  • A contact can have many groups.
  • A contact can have many emails and addresses
  • A contact can have one organization (employed)
  • A organization can have many contacts (employees)
  • A group can have many contacts.

What i have:

  • Contact(Id, PersonId (FK), OrganizationId (FK), EmployerId (FK, self reference))
  • Person(Id, FirstName, LastName, Birthday)
  • Organization(Id, Name, Founded)
  • Group(Id, Name)
  • ContactGroup(Id, ContactId (FK), GroupId (FK))
  • Email(Id, ContactId (FK), Name)
  • Address(Id, ContactId (FK), Street, City, ZipCode, Country)

What bothers me the most is that the contact entity has one organization or one person, and also a self reference (EmployerId) if a organization has employees (which are also contact entities) and vice versa.

Database design, Full size

Is this a problem or see you a better way?

I'm designing a database for contacts and I'm looking for some feedback on the current design.

What i want:

  • A contact can be a person or an organization.
  • A contact can have many groups.
  • A contact can have many emails and addresses
  • A contact can have one organization (employed)
  • A organization can have many contacts (employees)
  • A group can have many contacts.

What i have:

  • Contact(Id, PersonId (FK), OrganizationId (FK), EmployerId (FK, self reference))
  • Person(Id, FirstName, LastName, Birthday)
  • Organization(Id, Name, Founded)
  • Group(Id, Name)
  • ContactGroup(Id, ContactId (FK), GroupId (FK))
  • Email(Id, ContactId (FK), Name)
  • Address(Id, ContactId (FK), Street, City, ZipCode, Country)

What bothers me the most is that the contact entity has one organization or one person, and also a self reference (EmployerId) if a organization has employees (which are also contact entities) and vice versa.

enter image description here

Is this a problem or see you a better way?

Source Link

Contact system database design

I'm designing a database for contacts and I'm looking for some feedback on the current design.

What i want:

  • A contact can be a person or an organization.
  • A contact can have many groups.
  • A contact can have many emails and addresses
  • A contact can have one organization (employed)
  • A organization can have many contacts (employees)
  • A group can have many contacts.

What i have:

  • Contact(Id, PersonId (FK), OrganizationId (FK), EmployerId (FK, self reference))
  • Person(Id, FirstName, LastName, Birthday)
  • Organization(Id, Name, Founded)
  • Group(Id, Name)
  • ContactGroup(Id, ContactId (FK), GroupId (FK))
  • Email(Id, ContactId (FK), Name)
  • Address(Id, ContactId (FK), Street, City, ZipCode, Country)

What bothers me the most is that the contact entity has one organization or one person, and also a self reference (EmployerId) if a organization has employees (which are also contact entities) and vice versa.

Database design, Full size

Is this a problem or see you a better way?