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
24
votes
8 answers

How to know relations between tables

I have a database in MySQL created by someone. I don't have any documentation of the database. How can I know the relationship between the tables? Is there any query or a procedure to generate a report so that it's easy to find the relations? I…
Narasimha Maiya
  • 1,009
  • 4
  • 12
  • 35
23
votes
3 answers

SQLAlchemy ER diagram in python 3

Does anyone know a way to make an ER diagram from SQLAlchemy models in python 3. I found sqlalchemy_schemadisplay, which is python 2 because of pydot and ERAlchemy which is also python 2 only.
BrHa
  • 440
  • 1
  • 4
  • 9
23
votes
4 answers

Entity Relationship Diagram. How does the IS A relationship translate into tables?

I was simply wondering, how an ISA relationship in an ER diagram would translate into tables in a database. Would there be 3 tables? One for person, one for student, and one for Teacher? Or would there be 2 tables? One for student, and one for…
Brad Thiessen
  • 553
  • 1
  • 4
  • 13
23
votes
3 answers

ER-Diagram: Ternary Relationship - How to read properly?

Im not quite sure how to read ternary relationships within a ER-Diagram. Lets say this is the ternary relationship that is given. What can I interpret out of that? It says that you have to put your hand on 2 entity sets and then read it like…
user2276094
  • 399
  • 1
  • 4
  • 11
21
votes
6 answers

EF 4.1 - Model Relationships

I'm trying to create a quick ASP.NET MVC 3 application using the RC version of EF 4.1. I have two models: public class Race { public int RaceId { get; set; } public string RaceName { get; set; } public string RaceDescription { get; set;…
21
votes
3 answers

Is there a way to get all managed entities from an EntityManager

I'm setting up a basic test data util and want to keep track of all the data that the EntityManager handles. Rather than just having a bunch of lists for each entity is there a way to grab everything being managed by the EntityManager in one fell…
Th3sandm4n
  • 809
  • 4
  • 13
  • 23
21
votes
4 answers

JPA with JTA: Persist entity and merge cascaded child entities

I have a bidirectional one-to-many relationship with the following entity classes: 0 or 1 client <-> 0 or more product orders When persisting the client entity I want the associated product order entities to be persisted, too (as their foreign key…
SputNick
  • 1,231
  • 5
  • 15
  • 26
20
votes
2 answers

Loading Nested Entities / Collections with Entity Framework

I am trying to Eagerly load all the related entities or collection of Entity in one call. My Entities Looks like: Class Person { public virtual long Id { get; set; } public virtual string FirstName { get; set; } public virtual string…
20
votes
3 answers

fluent nhibernate - many-to-many relationship mapping on same entity

I am having a problem trying to map out a many-to-many relationship , where both sides of the relationship reference the same entity. I am using Fluent NHibernate and NH3.1. Basically, the scenario is this - I have a category, which can have…
20
votes
2 answers

When to use Associative entities?

Suppose there are two entities called Employee and Campaign. One employee can work on many campaigns. And one campaign can have many employees. I already know this is a many to many relationship. And when drawing the ER diagram (in Chen notation),…
Ivantha
  • 491
  • 2
  • 9
  • 27
20
votes
1 answer

Hibernate @OneToMany without a separate join table

Consider the following database schema: create table UserGroup ( id int not null auto_increment, name varchar(200), primary key(id)); create table User ( id int not null auto_increment, name varchar(200), groupId int not null, primary…
niklassaers
  • 8,480
  • 20
  • 99
  • 146
19
votes
4 answers

Should @JoinTable be specified in both sides of a @ManyToMany relationship?

I've an entity Course and an entity User. There's a many-to-many relationship between course and user, since a course can have many users and a user can be enrolled in many courses. In both entities I've put the @ManyToMany annotation on the…
nbro
  • 15,395
  • 32
  • 113
  • 196
19
votes
3 answers

PHP, Yii2 GridView filtering on relational value

Following on from this: Yii2 how does search() in SearchModel work? I would like to be able to filter a GridView column of relational data. This is what I mean: I have two tables, TableA and TableB. Both have corresponding models generated using …
Mr Goobri
  • 1,449
  • 5
  • 19
  • 42
19
votes
2 answers

Really simple CoreData relationship but returns nil and null?

This bug has been busting me for the past 4 hours. Also when I swap it round and get the User data first then Message data... the User.name will show, but the Message.message will not. So the data is definitely going in but the relationship between…
louisinhongkong
  • 551
  • 1
  • 6
  • 13
19
votes
1 answer

Generating ERD diagrams within Visual Studio

In order to create an ERD diagram for new projects I have been using Visual Studio's entity framework designer. Essentially I'm creating a "dummy project", adding entity framework via Nuget and diagramming away (I don't use Microsoft's Entity…
Jesse
  • 8,223
  • 6
  • 49
  • 81