I am not that much good at database diagraming. Whenever I am asked to create an ERR Diagram, I use MySQL WorkBench software.
However today I ended up in a conclusion when I see different types of ER Diagrams. My diagrams (designed via MySQL WorkBench) are like below.
And I saw other types of ER Diagrams like below.
Can someone please confirm which ER Diagram model should I use?
An Entity Relationship Diagram is an example of a presentation of a Conceptual Model. A Conceptual Model is used to help people understand the subject area(s) the model represents. Therefore, the correct presentation of a Conceptual Model - which may be or include an Entity Relationship Diagram - is one that all interested parties are satisfied adequately explains these subject areas.
These interested parties should include potential users of a system that incorporates the subject areas, managers of these areas and IT professionals who will be designing and building a system covering these areas.
The agreed Conceptual Model is then taken by the IT professionals and formalized into a Logical Model, which may be presented as a Relational Data Model.
Actually both of them are ER diagrams. However, the second one is its scientific representation. MySQL use a representation which is more understandable way of it.
Related
I am looking for good-designed and real life relational database diagrams. Could you offer any book or other sources? I prefer books.
Thank you.
Not sure what you mean with "real-life relational database diagrams", but any data structures that you need serialized in a relational (SQL) scheme, must first come from a class or class-like diagram. in order to create a well-designed relational database structure based on these classes, one must first submit it to a series of transformations, known as Normalization Degrees. This will help keep your database redundancy-free and organized. (except when redundancy is a business requirement defined by you).
PDF books:
http://cir.dcs.uni-pannon.hu/cikkek/Database_Normalization.pdf
http://www.cs.cityu.edu.hk/~helena/cs34622000B/Normalization.pdf
I hope this helps!
Good day,
Real estate companies have several Buildings, each Building managed by one or more Managers, Managers have access to one or more Buildings. So, there is a many-to-many relationship between Managers and Buildings. It has to be a table such as Permissions to get rid of many-to-many relationship.
Please help me to figure it out, what is the best design for the database ?
I came up with a two candidate diagrams, which one is better? If neither of them are good, what should I change ?
http://i.stack.imgur.com/Z0l6h.png
http://i.stack.imgur.com/Dg5Sv.png
Sincerely
The second picture seems closest
I'd suggest moving the boxes around a little to show the hierarchy. Put Companies top and center, then on the next row, Managers on the left, Buildings on the right and Permissions between those two.
ER diagrams are used for two different purposes. One purpose is to illustrate the subject matter entities, and the relationships between them, as understood by subject matter experts. This is called a conceptual model of the data.
The other purpose is to illustrate a proposed database design, one where the relationships are not only expressed, but also implemented somehow. If the design is relational (which it usually is) many-to-many relationships are expressed by creating an intermediate table. This is called a physical model of the data (in some literature it's called a logical model). This is what you have done in your second diagram.
Your first diagram could be cleaned up a little by eliminating the box named "permissions", and putting a crows-foot at both ends of the line connecting Managers and Buildings.
Now to come back to your question: which one is "better"? It depends. sometimes, a conceptual diagram is better for discussing the subject matter with the ultimate stakeholders: non-technical managers who work with the data all the time, and might be called "subject matter experts".
A physical diagram is usually better when discussing the proposed design among data architects and programmers. It explains not only how the data works in concept, but also how the database is to be built. This kind of detail is glossed over by a conceptual model.
So you may end up with two diagrams, and use the appropriate one depending on your audience.
What you do before starting the Database model diagram? I mean how you form the Requirements, Specifications etc. Use cases is one thing but anything else? Some best practice or a rule of thumb? Being a self learner I want to see how it goes in the hands of professionals?
Make sure you have a complete list of requirements from your client. Do your best to completely understand these requirements, it will really help in your design if you do. If YOU are defining the requirements it may be easier since you will already have an idea of what you need to do. Having a thorough grasp of your goal is the most important part.
If there is an obvious part of your database that will be the most important (an application in an online application system for instance) I will usually start from there and work out one piece at a time.
Personally I like to draw rough pictures (what ever makes sense to you, doesn't have to be an official ERD) of what I think the database will look like and revise it to finer levels of detail.
Don't rely only on written requirements. There is no such thing as a complete list of requirements. Talk to the stakeholders, ask questions and use the results of those interviews to determine what attributes need to be modelled, how they are used and to identify the business keys. Then some data analysis and investigation is usually needed to determine the right data types and other aspects.
It may be possible to get a good first cut of a data model up front but don't worry if you can't. Data modelling generally ought to be an iterative, agile process, done in sensible sized steps as a project evolves (although there are certainly cases like Data Warehouse design where the agile approach may be harder to apply).
Depending on your clientele, it can be a good idea to have two data models and two diagrams. One model and diagram is for data analysis. The other is for database design.
I have had good results by using an ER (Entity-Relationship) model and diagram for data analysis and an RDM (Relational Data Model) model and diagram to reflect database design.
The ER diagram is useful for communicating the requirements discovered so far back to the clients, and making sure they are complete and correct. ER diagrams are easy to understand even if the client has no background in database theory. As others have responded, this is an iterative process, not a once only waterfall.
The RDM model and diagram is useful for reflecting logical database design decisions such as the decision to normalize data or do something else. Its easy to derive an RDM model from an ER model, although you have to throw in some design decisions that are intentionally omitted from the ER diagram.
In turn, its easy to build a table create script from an RDM diagram. You will have to add some physical features like indexes, in order to obtain good performance without tearing your hair out.
Would like to find low-cost relational modeling tools that will allow me to map a logical model in third normal form to a physical model based on EAV. Got any pointers?
EAV fails to conform to rules of relational normalization, therefore there can be no relational modeling tools that support it.
If your model is in 3NF, then there's no reason to model it in EAV. Keep it in 3NF.
I am planning to build a database for a school application. I have designed a database to
hold time tables for all the classes. It should also relate to the teachers taking the
subject for the class. Also should be able to handle a public holidays mentioned. Also the
attendance of all the students and teachers. Please guide me with the best possible table
structure with the foreign key mapping if any. Thanks in advance.
The best advice I could tell you would be to try to put some basic effort in doing your school assigments. This is the key in becoming an accomplished programmer and professional.
There are numerous examples of database design here : http://www.databaseanswers.org/data_models/index.htm
An excellent technique you can use is called Entity-Relationship diagrams. They help you model out the aspects of your universe (in this case the school) you care about in order to build a good database.
There are many books that dwell on the question. But for a simple introduction (and links to other very useful articles) wikipedia is the place to start link.
A very useful rule-of-thumb to remember when using Entity-Relationship diagrams is that most of the time (almost always) a box in the ER diagram is a table in the database. A diamond on the other hand sometimes is and sometimes is not.
Read on this kinds of Diagrams, after you've done the first you will see it is an extremely powerful tool for modeling different universes.
Google for "open source school administration software". Then comparing all the solutions you will find with what you know about your domain will give you a far better idea of your requirements than we can.