Review Entity-Relationship Diagrams and the Relational Model
CS 186, Fall 2007, Lecture 2 R & G, Chaps. 2&3
A relationship, I think, is like a shark, you know? It has to constantly move forward or it dies. And I think what we got on our hands is a dead shark.
Woody Allen (from Annie Hall, 1979)
• Why use a DBMS? OS provides RAM and disk
Review
• Why use a DBMS? OS provides RAM and disk
– Concurrency – Recovery – Abstraction, Data Independence – Query Languages – Efficiency (for most tasks) – Security – Data Integrity
Data Models
• DBMS models real world • Data Model is link between user’s view of the world and bits stored in computer • Many models exist • We think in terms of..
– Relational Model (clean and common) –
…show more content…
– Owner entity set and weak entity set must participate in a one-to-many relationship set (one owner, many weak entities). – Weak entity set must have total participation in this identifying relationship set. name ssn lot cost pname age
• Basically means “at least one” name ssn Employees lot Manages since did dname budget Departments
Works_In
Means: “exactly one” since Employees
Policy
Dependents
Weak entities have only a “partial key” (dashed underline)
Binary vs. Ternary Relationships ssn name lot Covers pname age
Binary vs. Ternary Relationships (Contd.)
• Previous example illustrated a case when two binary relationships were better than one ternary relationship.
If each policy is owned by just 1 employee:
Employees
Dependents
Bad design
Key constraint on Policies would mean policy can name ssn only cover 1 dependent! • Think through all the constraints in the 2nd diagram! policyid lot
Policies cost pname age
Employees Purchaser
Dependents
Beneficiary
• An example in the other direction: a ternary relation Contracts relates entity sets Parts, Departments and Suppliers, and has descriptive attribute qty. No combination of binary relationships is an adequate substitute. (With no new entity sets!)
Better design policyid Policies cost
Binary vs. Ternary Relationships (Contd.) qty Parts Contract Departments
Summary so far
• Entities and Entity Set (boxes) • Relationships and Relationship sets
Which of the following defines a relationship in which each occurrence of data in one entity
At this stage, the specifics of the scope and the general content of the project has been identified and is the first step in database development. It illustrates the overall picture of organizational data at a high level of abstraction. In addition,
* As explained throughout this course, entity relationship modeling is a critical element of database design. If the database is not properly modeled, it is unlikely that the database will be properly developed. Using this knowledge, explain the key reasons why entity relationship modeling is important, and determine at least (1) way in which it impacts the overall development of the database.
During this week, I learned about the different types of constraints, the usefulness of the constraints, "join", union, intersection, difference, etc. Particularly, I learned how one relation is linked with other using the constraints and how we can maintain the data integrity and consistency using
2NF (Second Normal Form): The relation should not have any partial dependencies; part of the primary key should not identify a subset of attributes in the same table. The relation must be in 1NF before it can be in 2NF [12]
Following this procedure through we can arrive at a list which shows a detailed breakdown of the relationships, and as we have 6 entities there should be a total of 30 relationships as each entity will have a relationship with every other entity (5 each).
A one-to-many relationship is the most common relationship and is between two entities in which an instance of one entity can be related to many instances of a related entity. For this relationship a row in table C can have many matches in table A, but a matching row in table A can have only one match in C. Most relational databases are constructed from this type of relationship.
Identifying foreign keys: Every dependent and category entity in the design must have a foreign key for each relationship in which it participates. Foreign keys are formed in dependent and sub type entities by migrating the entire primary key from the parent or generic entity. If the primary key is composite, it may not be split.
3. Format-type constraints, what is their use, what effect do they have on the database (include a screenshot of a lookup from your own database)
Their Binary Types can further organize relationships: One-to-One relationships, One-to-Many relationships, and Many-to-Many relationships. The traditional model standards for ERDs call for diamonds representing relationships and rectangles representing classes. However, ERDs are loosely standardized and often look different from one another due to software such as Microsoft Access and MySql Workbench that create ERDs using proprietary applications.
foreign key is the id of a record in a different table. This is done through
A _______________ is an overall logical view of the relationships needed to support specific end-user application programs that will access the database.
Each foreign key of a table can become a foreign key for another table depending on the relation between those two tables.
The attributes further define the property. Some relationships between the entities can share more than one attribute and others share only one. The relationship diagram 1.1 will illustrate how the entities and attributes are linked together. Below is a list of the attributes for each of the entities in the database:
The relationship are then indicated by the common columns, or the domains, in the data tables are related. The Transitive Dependency within an entity type takes place of the non entity attributive attributes have dependency amongst there selves. Multi - Valued dependency likeness in the Entity Relationship Diagram can take place when the attributes within the entity example have more than one value. This is a potential instance when some attributes within an entity examples have the maximum cardinality of n, or more than 1. When the attribute has lots of values in an entity example, this can be setup either as the composite key modifier of the entity type, or then split into the weak entity type.