What is the best practice to create an Entity Relationship Diagram (ERD) that has more than 150 columns ? I need to create a documentation for my database, but at the moment I have a table that has more 150 columns, and all of these columns is required for the operationalization.
Related
I want to store Genetic variants of patients in a database. Number of patients are around 1000 but for each patient there are more than 100,000 Genetic variants. Can anyone advice me how to design this table. Is it possible to do this in MongoDB ? The data will look something like this. Any help will be highly appreciated
If you want to use a relational database. You should create a table for just patients and a separate table that has a foreign key pointing to the user and another column for the genetic variation. Instead of having a column per RS_***, those should be a row. So for example User A will have 100,000 rows in Table B each row being RS_{insert_index}.
I have a raw table having 28 columns and around 300 rows that I want to normalize. I wonder whether I should divide the table into sub tables based on entity characteristics in advance before normalization.
Also, should I figure out relationship (one-to-one, one-to-many, many-to-many) between each sub table before normalization? As far as I know, I have to make something called junction table for many-to-many relationship. I am confused about the procedure of designing a database given a single raw table. I appreciate your comments. Thank you.
I have a database design in which I have aprox. 5 entities that can be filtered. Currently these tables all have their own filter table, e.g. the product table has a productfilter table and the customer has a customerfilter table.
I have done some research since performance (as in speed to query the db) is the most important quality attribute, I am wondering whether having a single filter table and connecting the entities that rely on it with junction tables is a better option?
Important side note the filters would only ever be joined from the Customer or Product entities when using the junction tables.
Edit:
1: Without junction tables
2: With junction tables
Let's imagine you have a house . That house can have a swimming pool, a garden or anything else.
As we want to list those "features", I will create a feature table.
Now I will have a table called House and a table called Feature.
Should I include the features in the Feature table as columns in the House table, or it would be better to have a House_feature table where House.id and Feature.id are the primary keys?
In past projects I would use the second option, but I keep thinking that when you want to query, it is generally easier to have everything as columns. What would be the cons other than I would need to manually add columns in the future if I want to include any new feature?
This is a classic many-to-many relation - a house can have multiple features and a feature can be in multiple houses.
So you need a mapping table House_feature.
Any other option would not be normalized and only leads to problems.
i am having a hard time creating an ERD for my table relationship. I have 4 tables: film, ticket_type, studio, and schedule. The schedule table is a relationship table that contain the primary key from the other three tables as foreign key. The question is how can i picture it in ERD? Something like many-to-many relationship but with 3 table, is it possible to do it like this? The database works fine when i try to create it so i think there's no problem in my concept. Thanks in advance.
Edit: forgot to add the ticket_type table is for pricing and type like: 2d,3d,or 4d, i create it like this to avoid redundancy.
One more question, can i add another field to a relationship table? If I remember correctly it should be fine, but just to make sure.
If schedule is a relationship, it would be represented as follows on an entity-relationship diagram:
Relationships are identified by the keys of the related entities. A table diagram makes this more visible:
However, if schedule is an entity set with relationships to the other 3 entity sets, it would be represented as follows on an ER diagram:
If we map every entity set and relationship to its own table, we get the following table diagram:
However, if we denormalize the relationship tables into the schedule table (since they all have the same primary key), our table diagram changes to:
Compare this with the first table diagram. While these physical models are very similar, they derive from very different conceptual models. Strictly speaking, I think both "entity table" and "relationship table" are inappropriate for the denormalized schedule table. In the network data model, we would call it an associative entity (but that's not the same as associative entities in the ER model).
Finally, relationships can have attributes too: