Character Entity Reference Chart
Describes a standard set of named Unicode entities and the generation and use of a file defining these entities. PRECEDES UNDER RELATION. ⊰. ⊰ .. BLACK DOWN-POINTING SMALL TRIANGLE. ▾. ▾. For HTML Entities . TRIANGLE U+23EB ⏫ BLACK UP-POINTING DOUBLE TRIANGLE U+23EC ⏬ BLACK DOWN-POINTING DOUBLE TRIANGLE U+23ED . Р, Р, , , CYRILLIC CAPITAL LETTER ER ▾, ¾, , BLACK DOWN-POINTING SMALL TRIANGLE.
We must add T's key to S; we cannot do it the other way around. This might be more efficient if only a few s in S participate in the relationship; otherwise we would have many NULLs in the T-column of S.
N relationships Here we must create a table R of tuples including the key of S skthe key of T tkand any attributes of R; we can not push the data into either S or T. The sk column of R should have a foreign key constraint referring to the key column of S, and the tk column of R should similarly have a foreign key constraint to the key column of T. Again, we would have an appropriate foreign key constraint back to the original table. Make this a foreign key in E1. Make this new column a foreign key in E2, referencing E1.
For multivalued attributes of entity E, create a new relation R. One column of R will be E. Joins arise in steps 2, 3, 4, 5, 6, and 7, for recovering the original relationships or attribute sets for 6, or entities for 2.
In every case, the join field is a key of one relation and a foreign key in the other. Not all joins are about recovering relations from an ER diagram. Also, I said earlier that entity T should not have an attribute that was another entity of type S; instead, we should create a relationship R between T and S. If S was at all a candidate for an attribute, each T would be related to at most one S and so this would have cardinality constraint TNRS.
Then, when we did the above conversion, in step four we would add S's key to T with a foreign key constraint referring to S.
But suppose we did add S as an entity attribute to T. Then we would end up with the same situation: So in the end we get the same thing. Invoice How shall we model invoices?
An invoice is a collection of parts ordered, each with a quantity. An invoice is thus all the items to the same customer with the same date. For a given c and d there might be multiple parts p that were part of the invoice. Ternary relationships tend to be inefficient. Even if we do this, we have another issue: That is, we declare that orders are "things" rather than relationships.
Certainly, this is not earth shattering news. But it is in the ER diagram. The above fact is not represented as a separate relationship between division and employee because it can be inferred from existing relationships. An ER diagram should contain the minimum number of relationships necessary to reflect the situation.
For relationships between two entity types, there are three basic cardinalities. Each of the following descriptions are given in terms of a relationship between entity type X and entity type Y. One entity of type Y can be associated with, at most, one entity of type X. A car has only one steering wheel and a steering wheel can only be installed in one car. M one-to-many One entity of type X can be associated with many entities of type Y. A building can have many rooms but a room can be in, at most, one building.
M many-to-many One entity of type X can be associated with many entities of type Y. One entity of type Y can be associated with many entities of type X. A car can have many options and an option can be installed on many cars. Determine the cardinality of the relationships between the following four pairs of entity types. For each relationship you have to answer two questions: Answering these two questions gives you the answer to the following questions.
For example, if you answered M to the first question and 1 for the second question, then this relationship between entity types X and Y is of cardinality M: Patient under care of primary care physician Physician performs operation Doctors have speciality in disease Needle injected into patient It would seem that at any particular time a patient can only have one primary care physician and that any physician can have many patients M: One physician can perform many operations and one operation can be performed by many physicians M: One doctor can have specialities in many diseases and one disease can be the speciality of many doctors M: In this section we examine the minimum number of entities in a relationship.
Existence is given as optional, mandatory, or unknown. This is best clarified with an example. Consider again the example discussed in Section 2. Specifically, focus on the manage relationship between department and employee. We know the cardinality is 1: This tells us that at most one department is managed by an employee and an employee can manage, at most, one department. Be sure you understand the distinction between these two phrases. The existence of this relationship tells us the fewest number of departments that can be managed by an employee and the fewest number of employees that can manage a department.
Only one of the following can be true: Similarly, only one of the following may be true: For each set of three above, which ones would you choose? It is not entirely clear from the situation description which of the above are true.
I make the relatively standard assumptions that a department must have at least one manager and that an employee need not be the manager of any department. Thus, the existence of this relationship is mandatory in one direction and optional in the other.
Going back to the definition of existence, we can also look at this situation in this way: Given any randomly chosen department, there must be an employee on the other side of the manage relationship. Thus, the relationship is mandatory in this direction. Given any randomly chosen employee, there need not be any department on the other side of the manage relationship.
Thus, the relationship is optional in this direction. I assume that the contains relationship is mandatory in both directions. Given this information, the ER diagram is modified in the following manner: This diagram is beginning to look a little complicated but remember the following pieces of information and it gets a little easier: The marks on the lines tell you the minimum number in a relationship.
A dash on the line looks like a 1; it tells you the minimum number in the relationship is one so the existence is mandatory. A circle on the line looks line a 0; it tells you the minimum number in the relationship is zero so the existence is optional.
- Table of Contents
- 1 Databases, this class, and you
If there are not any marks on the line, then the existence is unknown. The marks below the line tell you the maximum number in a relationship. An M tells you the cardinality is many while a 1 tells you it is one. Look at the manages relationship again. Cover up the line connecting the manages diamond with the department rectangle. Now all you see are the department entity type, the employee entity type, and the right side of the line with a dash on it and a one below it.
This tells us that a department is managed by at least the dash one employee and at most the 1 one employee. A department is managed by one and only one employee. Cover up the line connecting the manages diamond with the employee rectangle. Now all you see are the department entity type, the employee entity type, and the left side of the line with a circle on it and a 1 below it.
This tells us that an employee does not have to manage any departments the circle and may manage at most the 1 one department. An employee may manage no more than one department. For each of the relationships listed in Problem 5: Define the existence in both directions. Draw the ER diagram for the relationship. Write out two sentences that represent what the ER diagram says. If it is not important, it should not be in the database. In an accounting database you would expect to find entity types for expenses, assets, liabilities, expenditures, deposits, etc.
You would not expect to find entity types for colour of check, quality of dollar bills received, etc. The database is supposed to reflect realitybut only the part of reality that is important to the company. This allows us to make generalisations about that type. This is a powerful capability; however, sometimes we want to make a generalisation only about a certain subset of those entities and another generalisation about the rest of the entities. Consider a simple example.
Suppose you have an accounting database which keeps track of accounts receivable and accounts payable. Of course the database keeps track of the companies to which you owe money and the companies that owe you money. For all these companies, you keep track of their mailing address and a contact person.
For the companies that owe you money you keep track of how much they owe you. For the companies that you owe money you keep track of how much you owe them.XML Chapter 4 - XML Entities
Should we have three entity types: That would be a mess. That is why the concept of entity subtypes was created. In this company example, what is the entity type? What are the subtypes? In this database you should define a company entity type with two subtypes: The company entity type stores all facts that are common attributesin this case, the address and contact person. There are many situations in which subtypes can be created but should not be. Only create subtypes if the subtype is involved in relationships that the other subtypes are not or if the subtype needs to have additional facts stored with it.
If one of these two requirements is not met, then do not create the subtype. What is the relationship among the following? List a few facts common to all items for each question. List a few facts about each subtype that is not common to the other subtype. Also draw the ER diagram for each.
Consider the following figure. Many students would first suggest the diagram on the rightdivide customers into investors and attendees and show that investors buy stocks and attendees register for seminars. I suggest that the figure on the left is better. What is it that makes an investor an investor? And what is it that makes an attendee an attendee? She registers for seminars. Is there anything about an investor that keeps her from being an attendee?
Do you want to prevent investors from being classified as attendees or vice versa? So, define relationships buy and register for the customer entity.
HTML Special Character Codes
Investors can be listed by choosing only those customers that are in the buy relationship. Attendees can be listed by choosing only those customers that are in the register relationship. Thus, if a relationship defines the members of a proposed subtype, then use the relationship instead of the subtype.
What we are trying to discern here is the difference between a type of a thing and an actual thing. This is a pretty easy concept when comparing people and Joe. People is the type and Joe is the instance. The section is an actual class that meets at an actual time with an actual teacher and actual students. CT is a type of thing that is an idea that only becomes real when you come into contact with one of its instances e. Realize that this is a different distinction than that between entity types and entities.
In this example, CT is one specific instance of the entity type Course and section 2 of CT in Winter is one specific instance of the entity type Section. Thus, both are entities and neither one is an entity type. Boeing is a type of plane and a specific Boeing that flies through the air with passengers in it is an instance of this type. Boeing is a specific instance of the entity type plane type and a flying Boeing with passengers is a specific instance of an entity type plane.
In this section I hope to make these ideas a little more clear. Attributes are the characteristics of an entity type that we are interested in. An attribute is a descriptor whose values are associated with individual entities of a specific type. The attribute value for any single entity can have only one value at a given time. This value can change over time. An attribute of an employee might be salary. At any one time if you asked for the salary level of a certain employee, then you should get one answer.
And if someone else asked the same question about that employee at the exact same time, they would expect to get the same answer. Of course, if you asked this question at a later time you might expect to get a different answer. Think back to the example in Section 2. Few attributes are mentioned in the description but a few can be inferred. The department entity type has a name attribute, as do the division and employee entity types.
This identifier uniquely identifies a single at least one, and no more than one entity. If you know the value of the identifier, then you know exactly which entity you are dealing with. Thus, if you know the identifier now, then you can be confident that at any time in the future the identifier for that entity will not have changed.