Questions tagged [entity-relationship]

An entity-relationship model (ERM) is an abstract and conceptual representation of data, information aspects of a business domain or its process requirements. Ultimately ERM is being implemented in a database.

Entity-relationship modeling is a database modeling method, used to produce a type of conceptual schema or semantic data model of a system, often a relational database, and its requirements in a top-down fashion. Diagrams created by this process are called entity-relationship diagrams, ER diagrams, or ERDs.

The main components of the ER diagrams are the entities and the relationships that exist among them. For example with the original notation, in the relational databases tables are shown as boxes, its attributes as ovals and their relations with other tables with lines.

The three schema approach to software engineering uses three levels of ER models that may be developed:

  • Conceptual data model is the highest ER model, that contain least granular detail but establishes the overall scope of what to be included in the model set.

  • Logical data model contains more detail than the conceptual ER model. Operational and transcational data entities are defined.

  • Physical data model - one or more such models can be developed from each logical ER model. Normally developed to be instantiated as a database, therefore each physical model must contain enough detail to produce a database.

2962 questions
6
votes
1 answer

Entity Framework Code First Mapping

I have two classes, the Group class has a many to many relationship with the User class (representing the groups a user belongs to) and then the group also has a relationship of one to many with the user class (representing the owner of a…
6
votes
1 answer

MSSQL: Unable to create relationships for two foreign keys to the same table?

Hi using SQL Server 2008, I've built a small database for a baseball league, I'm having problem creating relationships between the Teams(PK: TeamID) and GameSchedule(PK: GameID, FK1: HomeTeamID, FK2: AwayTeamID) I want to create relationships betwen…
Eric
  • 462
  • 1
  • 5
  • 13
6
votes
2 answers

Entity Framework - Keep loaded/included related objects after end using?

I am trying to have a query in a method that looks like this: Public Shared Function listParticipationsByTeamCount(ByVal count As Integer, ByVal challenge As Challenge) As List(Of Participation) Dim participationList As List(Of Participation) …
SventoryMang
  • 10,275
  • 15
  • 70
  • 113
6
votes
1 answer

How to attach an object that contains a n to n relation?

I have two tables that are linked n-n. And I have a method that takes one object and saves. public int Save(Table1 element) { using (var database = new Entities()) { if (element.ID == 0) { …
BrunoLM
  • 97,872
  • 84
  • 296
  • 452
6
votes
1 answer

Mapping value-type collection in Entity Framework

Similar question: Mapping collection of strings with Entity Framework or Linq to SQL I have a role class: public class Role { public int RoleID { get; set; } public virtual IList Actions { get; set; } } I have a mapping table in the…
reustmd
  • 3,513
  • 5
  • 30
  • 41
6
votes
3 answers

Foreign Keys vs. Partial Keys and their E-R representations

I'm having trouble understanding the difference between partial keys/weak entities and foreign keys. I feel like an idiot for not being able to understand this stuff. As I understand it: Weak Entity: An entity that is dependent on another…
prelic
  • 4,450
  • 4
  • 36
  • 46
6
votes
8 answers

What is the best way to represent a many-to-many relationship between records in a single SQL table?

I have a SQL table like so: Update: I'm changing the example table as the existing hierarchical nature of the original data (State, Cities, Schools) is overshadowing the fact that a simple relationship is needed between the items. entities id …
GloryFish
  • 13,078
  • 16
  • 53
  • 43
6
votes
3 answers

Derived Types in Entity Framework

I have a Person Class and Inventory can be two types: Sales and CustomerService. Sales and CustomerService have their unique properties and Peron holds the common properties. I want to be able to query So, when creating all three classes how do i…
6
votes
1 answer

relationships between 3 entities in ER diagram--is a ternary enough or are 2 binaries also needed?

I'm trying to draw an ER diagram for my project management software describing the following. It contains these entities: project - software projects tasks - software projects that can be broken into a number of tasks employees - employees that…
6
votes
1 answer

Concerns about Guidelines for Creating Entity Relationship Models

I am currently enrolled in the online Oracle Academy Database Design Course, which briefly talks about the concept of nontransferable relationships. I understand the concept behind them, but the course's vague details left me with a few of…
Zampanò
  • 574
  • 3
  • 11
  • 33
6
votes
6 answers

how to save marital relationship in a database

I have to save this information in a database Person -> is married to -> Person Where should I save that information? What is the proper design pattern should I apply here? Thank you!
6
votes
1 answer

JPA persist object in a ManyToOne relationship

I have a company/employee @OneToMany relation in my database defined as: @Entity public class Employee { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long id; @ManyToOne @JoinColumn(name="companyid") Company company; …
tal
  • 61
  • 1
  • 1
  • 2
6
votes
3 answers

How to model messages exchanged between users? - ER Diagram

I'm trying to design an ER diagram where i have a USER and a MESSAGE entity. Users can send messages to other users. I have designed 2 alternative diagrams for this but i'm not sure which one is the correct.
kelua
  • 283
  • 1
  • 4
  • 9
6
votes
1 answer

How @JoinColumn and @MappedBy works

I am confused over working on @JoinColumn and @MappedBy. Consider following example Here is my Department class with unidirectional relationship @Entity @Table(name = "DEPARTMENT") public class Department { @Id @Column(name =…
eatSleepCode
  • 4,427
  • 7
  • 44
  • 93
6
votes
1 answer

Entity Relationships: Difference between solid line and dotted line

In the use of table relationship. What is the difference in the use of solid line and dotted line? For Example TABLE : MESSAGES / TABLE : USERS An User have 0 or Many Messages. Solid line or Dotted Line?
andrecoweb
  • 171
  • 1
  • 2
  • 6