Can an Entity Relationship diagram model question have multiple correct answers?. (Simply, Is there only one correct model for an ER Diagram?).
ERD (entity relation diagram ) it's logical step Can one see relation is a ternary between 3 tables and another one see the best answer to be many to many . It's debend on requirements and your view.
Related
I need to create a tabular model with ssas but in a fact table I have two relations with the same dimension (time).
How is it best to handle this?
Duplicating the dimensions table ?
Thanks
You don't need to duplicate the dimension table. You can create both relationships, setting one as INACTIVE. Once this relationship is set up you can invoke the inactive relationship using the USERELATIONSHIP function. This will essentially make the relationship ACTIVE for that measure.
The following links give a great explanation followed by some examples.
Link 1
Link 2
Thanks for your answer,
this model is going to be used by business user and the haven't deep knowledge of dax.
I can't develop all the measures several times (also because it is about 4 dates per table and about fifty measures).
Whant do you think about this:
https://www.biinsight.com/role-playing-dimension-ssas-tabular/#more-1068
Thanks
If I have two entities, "Courses" and "Course_offerings", and they both have a key called "course number" , how do I relate these two entities? A relationship table does not make sense because it would be mapping the same course number to the same course number, which is redundant. But leaving them unlinked seems wrong. What is the correct way to do this for the ER model?
What would an ER diagram for this look like?
I'm still learning how to design databases for my applications and need some help organizing the database for a Movie Critic application.
A critic has many comments and a comment can only belong to one critic. Do I need a link table?
My understanding is the following:
Comment Table
id
comment
critic_id
Critic Table
id
first_name
last_name
I understand how to link the Comment to the critic through the critic_id. However, a critic can have multiple comments and I'm confused as how to design this into the database. Obviously a Critic cannot have multiple Comments in the same database row so my assumption is that I need some sort of link table.
I'm using rails and could really benefit from details on how to properly set up the relationships in the model (ex: has_many, belongs_to, etc.)
Since you have a one-to-many relationship, your design is fine. Multiple comments of the same critic will have multiple rows in Comment table, each with its own id but sharing the same critic_id.
You only need to consider whether to keep the non-identifying relationship that you have now or perhaps use an identifying relationship instead.
Only if you had a many-to-many relationship would you need a link (aka. junction) table.
What can be the best relationship for disease and symptom?
I think should be Many to Many (n2n).
But if I want to retrive desease once user selected diseases
how will be the query for it?
You need to be more specific about what you are looking for?
From what I understand from your question,
A diesase can have many symptoms.
Different symptoms can point to different diseases. It is a many to many relationship.
Are you constructing an ER diagram for a schema ? Or are you trying to write a query to retrieve data ?
I often see "linking" tables for M:N relationship, where N can be 1..X types of entities/classes, so that the table contains classNameId referring to ClassName table and classPK referring to the particular Entity table.
How is this called ? Does it have an alternative with the same effect without having the EntityName table ?
In the ER model, entities and subentities can be related by inheritance, the same way classes and subclasses are in an object model. The problem comes up when you transform your ER model into a relational model. The relational model does not support inheritance as such.
The design pattern is called is called generalization-specialization or gen-spec for short. Unfortunately, many database tutorials skip over how to design tables for a gen-spec situation.
But it's well understood.It looks quite different from your model, but you could create views that make it look like your model if necessary. Look up "generalization specialization relational modeling" for explanations of how to do this.
The main trick is that the specialized tables "inherit" the value of their primary key from the PK of the generalized table. The meaning of "inherit" here is that it's a copy of the same value. Thus the PK in each specialized table is also an FK link back to the correpsonding entry in the generalized table.