DOC PREVIEW
SJSU CS 157A - Final Exam Revision 5

This preview shows page 1-2-3-4-30-31-32-33-34-62-63-64-65 out of 65 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 65 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Final Exam Revision 5Entity Sets customer and loanAttributesComposite AttributesRelationship SetsRelationship Set borrowerRelationship Sets (Cont.)RELATIONSHIPSRELATIONSHIPS (Cont…)BINARY RELATIONSHIPE-R DiagramsE-R Diagram With Composite, Multivalued, and Derived AttributesRelationship Sets with AttributesCardinality ConstraintsOne-To-Many RelationshipMany-To-One RelationshipsMany-To-Many RelationshipParticipation of an Entity Set in a Relationship SetExample: Company DatabaseSlide 20RolesSlide 22KEYKEY (Cont…)GENERALIZATION AND SPECIALIZATIONSlide 26Slide 27Slide 28EXAMPLECreating TablesCreating a TableAn ExampleConstraints in Create TableNot Null ConstraintPrimary Key ConstraintPrimary Key Constraint (Syntax 2)Another TableForeign Key ConstraintTranslating ER-Diagrams to Table DefinitionsGeneral PrincipalsRelations vs. TablesSimple entity translationSlide 43Translating EntitiesSlide 45Translating Relationships (without constraints)Translating relationships (without constraints)Translating Recursive Relationships (without constraints)Translating relationships (key constraints): Option 1Slide 50Translating relationships (key constraints): Option 2Slide 52Translating relationships (key constraints)Translating relationships (participation constraints)Slide 55Slide 56Translating Weak Entity SetsTranslating ISA: Option 1Translating ISA: Option 2Which Option To Choose?Translating AggregationE-R Design RefinedSlide 63SummarySlide 65Final Exam Revision 5Prof. Sin-Min LeeDepartment of Computer ScienceEntity Sets customer and loancustomer-id customer- customer- customer- loan- amount name street city numberAttributes•An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set.•Domain – the set of permitted values for each attribute •Attribute types:–Simple and composite attributes.–Single-valued and multi-valued attributes•E.g. multivalued attribute: phone-numbers–Derived attributes•Can be computed from other attributes•E.g. age, given date of birthExample: customer = (customer-id, customer-name, customer-street, customer-city)loan = (loan-number, amount)Composite AttributesRelationship Sets•A relationship is an association among several entitiesExample:Hayes depositor A-102customer entity relationship set account entity•A relationship set is a mathematical relation among n  2 entities, each taken from entity sets{(e1, e2, … en) | e1  E1, e2  E2, …, en  En}where (e1, e2, …, en) is a relationship–Example: (Hayes, A-102)  depositorRelationship Set borrowerRelationship Sets (Cont.)•An attribute can also be property of a relationship set.•For instance, the depositor relationship set between entity sets customer and account may have the attribute access-dateRELATIONSHIPS•A relationship set is represented as a•A relationship may involve two entities, binary relationship:•A relationship may involve three entities, ternary relationship:Football TeamsfansPeopleFootball TeamsfansPeopleDateRELATIONSHIPS (Cont…)•A relationship may involve n entities, N-ary relationship•It is always possible to replace a non-binary relationship set by a number of distinct binary relationship setsFootball TeamsfansPeopleDateonBINARY RELATIONSHIPA binary relationship between entity set A and B might be:•1:1 Women marrying Men (function)•N:1 Children having mothers (function)•1:N Mothers having children (inverse function)•M:N Students enrolled in a classwomenmarrymenchildrenhavingmothersmothershavingchildrenstudentsenrolledclasses1nn1ABABABABE-R DiagramsRectangles represent entity sets.Diamonds represent relationship sets.Lines link attributes to entity sets and entity sets to relationship sets.Ellipses represent attributesDouble ellipses represent multivalued attributes.Dashed ellipses denote derived attributes.Underline indicates primary key attributes (will study later)E-R Diagram With Composite, Multivalued, and Derived AttributesRelationship Sets with AttributesCardinality Constraints•We express cardinality constraints by drawing either a directed line (), signifying “one,” or an undirected line (—), signifying “many,” between the relationship set and the entity set.•E.g.: One-to-one relationship:–A customer is associated with at most one loan via the relationship borrower–A loan is associated with at most one customer via borrowerOne-To-Many Relationship•In the one-to-many relationship a loan is associated with at most one customer via borrower, a customer is associated with several (including 0) loans via borrowerMany-To-One Relationships•In a many-to-one relationship a loan is associated with several (including 0) customers via borrower, a customer is associated with at most one loan via borrowerMany-To-Many Relationship•A customer is associated with several (possibly 0) loans via borrower•A loan is associated with several (possibly 0) customers via borrowerParticipation of an Entity Set in a Relationship SetTotal participation (indicated by double line): every entity in the entity set participates in at least one relationship in the relationship setE.g. participation of loan in borrower is total every loan must have a customer associated to it via borrowerPartial participation: some entities may not participate in any relationship in the relationship setE.g. participation of customer in borrower is partialExample: Company Database•Description of Data Requirements1. The company is organized into departments. Each department has a unique name, a unique number, and a particular employee who manages the department. We keep track of the start date when that employee began managing the department. A department may have several locations.2. A department controls a number of projects, each of which has a unique name, a unique number, and a single location.Example: Company Database3. We store each employee's name, SSN, address, salary, sex, and birth date. An employee is assigned to one department but may work on several projects, which are not necessarily controlled by the same department. We keep track of the number of hours per week that an employee works on each project. We also keep track of the direct supervisor of each employee.4. We want to keep track of the dependents of each employee: first name, sex, birth date, relationship to the


View Full Document

SJSU CS 157A - Final Exam Revision 5

Documents in this Course
SQL

SQL

18 pages

Lecture

Lecture

44 pages

Chapter 1

Chapter 1

56 pages

E-R Model

E-R Model

16 pages

Lecture

Lecture

48 pages

SQL

SQL

15 pages

SQL

SQL

26 pages

Lossless

Lossless

26 pages

SQL

SQL

16 pages

Final 3

Final 3

90 pages

Lecture 3

Lecture 3

22 pages

SQL

SQL

25 pages

Load more
Download Final Exam Revision 5
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Final Exam Revision 5 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Final Exam Revision 5 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?