ERD including supertype, subtype database - database

I'm drawing an ERD for a database and want to know if you need to include the supertypes and sub-types in the ERD. If yes, how to represent it. Thanks.

google for "ER Specialization". This is the term used in ER literature for subtyping. You should get some ways to diagram it, using the "Is-a" triangle connector. Some tutorials place it in "Extended ER features".

Related

How do I interpret Entity Relationship Diagrams?

I just learnt about ERDs, how to generate them and their purpose today. I tried generating to chart the structure of the database of my website using pygraphviz, pyparsing and pydot but I realised I have no idea how to read this cool-looking diagram.
Can anyone help me interpret this? Any help is very much appreciated!!
Here is the picture:
Here's one tiny part of your picture cropped so I can actually read the text in the image.
Each block with the dark box at the top is one of your database tables.
The Message table (entity) is probably the most reasonable one to talk about. All of the columns of the Message table are listed in the box.
The lines connecting boxes are the relationships between the tables. One of the lines points to the Recipient table(entity). That entity is connected by the received_messages code.
Hence, the diagram is called an entity-relationship diagram. Here's a more detailed explanation I found: What is Entity Relationship Diagram (ERD)?
Generally, you draw independent portions of your database in separate diagrams so it doesn't get so confusing.

Best Relational Database Diagrams

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!

What is the "Real" ER Diagram?

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.

Many-to-many relationship ERD

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.

School Database Design Required

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.

Resources