Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

The entity integrity rule states that

12/11/2021 Client: muhammad11 Deadline: 2 Day

• Logical Database design and Relational Model

• Chapter 4

Lesson Content:

• What is a ‘Relations’? • What is a ‘Relational Model’? • Component of a ‘Relational Model’? • How Relations are different to E-R Diagram? • Keys in Relations. • What is integrity constraints? • What is Referential Integrity? • Mapping E-R diagram to Relational Models:

• Unary • Binary • Ternary • Supertype/Subtypes

• Data Normalization: Form 1, Form 2, and Form 3. 2

What is a Relations?

• A relation is a named, two-dimensional table of data.

• A table consists of rows (records) and columns (attribute or field).

• Requirements for a table to qualify as a relation: • It must have a unique identifier (primary key).

• Every attribute value must be atomic (not multivalued, not composite).

• Every row must be unique (can’t have two rows with exactly the same values for all their fields).

• Attributes (columns) in tables must have unique names.

• The order of the columns must be irrelevant.

• The order of the rows must be irrelevant.

3

Correspondence with E-R Model

• Relations (tables) correspond with entity types.

• Rows correspond with entity instances.

• Columns correspond with attributes.

• NOTE: The word relation (in relational database) is NOT the same as the word relationship (in E-R model).

4

Integrity Constraints

1. Entity Integrity • No primary key attribute may be null. All primary key fields MUST have data.

2. Action Assertions • Business rules (Recall from Chapter 3)

3. Domain Constraints • Allowable values for an attribute (We shall see this clearly next)

5

6

1. Domain Constraints Allowable values for an attribute.

Referential Integrity:

• Referential Integrity–rule states that any foreign key value (on the relation of the many side) MUST match a primary key value in the relation of the one side. (Or the foreign key can be null) • For example: Delete Rules

• Restrict–don’t allow delete of “parent” side if related rows exist in “dependent” side

• Cascade–automatically delete “dependent” side rows that correspond with the “parent” side row to be deleted

• Set-to-Null–set the foreign key in the dependent side to null if deleting from the parent side  not allowed for weak entities

7

8

Figure 4-5

Referential integrity constraints (Pine Valley Furniture)

Referential integrity

constraints are drawn via

arrows from dependent to

parent table

Transforming EER Diagrams into Relations

•Mapping Regular Entities to Relations • Simple attributes: E-R attributes map directly onto the

relation • Composite attributes: Use only their simple, component

attributes • Multivalued Attribute: Becomes a separate relation with a

foreign key taken from the superior entity

9

(a) CUSTOMER entity

type with simple

attributes

Figure 4-8 Mapping a regular entity

(b) CUSTOMER relation

10

Transforming EER Diagrams into Relations (cont.)

•Mapping Binary Relationships • One-to-Many–Primary key on the one side becomes

a foreign key on the many side • Many-to-Many–Create a new relation with the

primary keys of the two entities as its primary key • One-to-One–Primary key on mandatory side

becomes a foreign key on optional side

11

12

Figure 4-12 Example of mapping a 1:M relationship

a) Relationship between customers and orders

Note the mandatory one

b) Mapping the relationship

Again, no null value in the foreign

key…this is because of the mandatory

minimum cardinality.

Foreign key

13

Figure 4-13 Example of mapping an M:N relationship

a) Completes relationship (M:N)

The Completes relationship will need to become a separate relation.

14

new

intersection

relation

Foreign key

Foreign key

Composite primary key

Figure 4-13 Example of mapping an M:N relationship (cont.)

b) Three resulting relations

Transforming EER Diagrams into Relations (cont.)

•Mapping Unary Relationships • One-to-Many–Recursive foreign key in the same relation • Many-to-Many–Two relations:

• One for the entity type • One for an associative relation in which the primary key has

two attributes, both taken from the primary key of the entity

15

16

Figure 4-17 Mapping a unary 1:N relationship

(a) EMPLOYEE entity with

unary relationship

(b) EMPLOYEE

relation with

recursive foreign

key

17

Figure 4-18 Mapping a unary M:N relationship

(a) Bill-of-materials

relationships (M:N)

(b) ITEM and

COMPONENT

relations

Transforming EER Diagrams into Relations (cont.)

•Mapping Ternary (and n-ary) Relationships •One relation for each entity and one for the associative

entity •Associative entity has foreign keys to each entity in the

relationship

18

19

Figure 4-19 Mapping a ternary relationship

a) PATIENT TREATMENT Ternary relationship with associative entity

20

b) Mapping the ternary relationship PATIENT TREATMENT

Remember that

the primary key

MUST be unique.

Figure 4-19 Mapping a ternary relationship (cont.)

This is why treatment

date and time are

included in the

composite primary

key.

But this makes a very

cumbersome key…

It would be better to create

a surrogate key like

Patient-Treatment#.

Transforming EER Diagrams into Relations (cont.)

• Mapping Supertype/Subtype Relationships • One relation for supertype and for

each subtype

• Supertype attributes (including identifier and subtype discriminator) go into supertype relation

• Subtype attributes go into each subtype; primary key of supertype relation also becomes primary key of subtype relation

• 1:1 relationship established between supertype and each subtype, with supertype as primary table 21

22

Figure 4-21

Mapping supertype/subtype relationships to relations

These are implemented as one-to-one relationships.

Data Normalization

•Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of data • The process of decomposing relations with anomalies

to produce smaller, well-structured relations

23

Anomalies in this Table

• Insertion–can’t enter a new employee without having the employee take a class (or at least empty fields of class information)

• Deletion–if we remove employee 140, we lose information about the existence of a Tax Acc class

• Modification–giving a salary increase to employee 100 forces us to update multiple records

24

Why do these anomalies exist?

Because there are two themes (entity types) in this one relation. This results in data duplication and an

unnecessary dependency between the entities.

Data Normalization

• Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of data

• The process of decomposing relations with anomalies to produce smaller, well-structured relations

• When data does not look normal we normalize it! 25

Well-Structured Relations

• Characteristics: • A relation that contains minimal data redundancy and allows users to insert,

delete, and update rows without causing data inconsistencies

• Goal is to avoid anomalies • Insertion Anomaly–adding new rows forces user to create duplicate data.

• Deletion Anomaly–deleting rows may cause a loss of data that would be needed for other future rows (Remember referential integrity?).

• Modification Anomaly–changing data in a row forces changes to other rows because of duplication.

26

General rule of thumb: A table should not connect to more than one entity type.

27

Table with multivalued attributes, not in 1st normal form

Note: This is NOT a relation.

28

Table with no multivalued attributes and unique

rows, in 1st normal form

Note: This is a relation, but not a well-structured one.

Notice that we have more than one table here.

Anomalies in this Table

Insertion–if new product is ordered for order 1007 of existing customer, customer data must be re-entered, causing duplication

Deletion–if we delete the Dining Table from Order 1006, we lose information concerning this item’s finish and price

Update–changing the price of product ID 4 requires update in multiple records

29

Why do these anomalies exist?

Because there are multiple themes (entity types) in one relation. This results in duplication and an

unnecessary dependency between the entities.

Second Normal Form

•1NF PLUS every non-key attribute is fully functionally dependent on the ENTIRE primary key • Every non-key attribute must be defined by the entire key, not

by only part of the key • No partial functional dependencies

•What they mean: Split the tables so each table has attributes related only to the primary key.

30

31

OrderID OrderDate, CustomerID, CustomerName, CustomerAddress

Therefore, NOT in 2nd Normal Form

CustomerID CustomerName, CustomerAddress

ProductID ProductDescription, ProductFinish, ProductStandardPrice

OrderID, ProductID OrderQuantity

Figure 4-27 Functional dependency diagram for INVOICE

32

Partial dependencies are removed, but there are still transitive dependencies.

- Transitive dependency means: find tables within tables.

- Clever students do sometimes find these tables from the first attempt so they

move from F2 to F3 immediately.

Getting it into Second Normal Form

Figure 4-28 Removing partial dependencies

Third Normal Form

• 2NF PLUS no transitive dependencies (functional dependencies on non-primary-key attributes)

• Note: This is called transitive, because the primary key is a determinant for another attribute, which in turn is a determinant for a third

• Solution: Non-key determinant with transitive dependencies go into a new table; non-key determinant becomes primary key in the new table and stays as foreign key in the old table

33

34

Transitive dependencies are removed.

Figure 4-29 Removing partial dependencies

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Peter O.
Essay Writing Help
Top Rated Expert
Calculation Master
Assignment Helper
Accounting & Finance Mentor
Writer Writer Name Offer Chat
Peter O.

ONLINE

Peter O.

After reading your project details, I feel myself as the best option for you to fulfill this project with 100 percent perfection.

$17 Chat With Writer
Essay Writing Help

ONLINE

Essay Writing Help

I have assisted scholars, business persons, startups, entrepreneurs, marketers, managers etc in their, pitches, presentations, market research, business plans etc.

$36 Chat With Writer
Top Rated Expert

ONLINE

Top Rated Expert

I have assisted scholars, business persons, startups, entrepreneurs, marketers, managers etc in their, pitches, presentations, market research, business plans etc.

$33 Chat With Writer
Calculation Master

ONLINE

Calculation Master

I have done dissertations, thesis, reports related to these topics, and I cover all the CHAPTERS accordingly and provide proper updates on the project.

$42 Chat With Writer
Assignment Helper

ONLINE

Assignment Helper

I have read your project description carefully and you will get plagiarism free writing according to your requirements. Thank You

$47 Chat With Writer
Accounting & Finance Mentor

ONLINE

Accounting & Finance Mentor

I am an elite class writer with more than 6 years of experience as an academic writer. I will provide you the 100 percent original and plagiarism-free content.

$25 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Theories of Development Case Study X2 - 1023 notification of incorrect answers - In icd 10 pcs which character represents a cochlear implant - Iot based energy meter block diagram - Alans fish bar ely - Sydney passport office lee street - There are ten in the bed - Markeaton park paddling pool - Week 3 Discussion - Phases of the helping process in social work - Food Journal - Rite aid pharmacy mission statement - Pop culture essay outline - What does the fog represent in cuckoo's nest - All instruments in the percussion family - Paulo freire pedagogy of the oppressed pdf download - Booms and bitner marketing mix - Case study - Cook farm supply company manufactures - Study design psychology vce - Jackson automotive case study solution - Hacking into harvard case 2.1 answers - Sarah orne jewett biography - The boy in the striped pajamas summary - Discussion post - Tax credits were offered for expenditures on home insulation - Fast track couriers business plan - Chapter 22 descent with modification a darwinian view of life - Example of speech outline about life - Use case for online shopping system - How many vertices in a cube - Metamotivation according to maslow - Informatics - Engineering ethics charles b fleddermann pdf - Pounds per cubic feet to kilograms per cubic meter - Psychosocial Development DUE IN 72 HOURS - The man who shot liberty valance short story pdf - National theatre of scotland - To kill a mockingbird novel study questions and answers - Discussion art film - Русские фразеологизмы на английском - Rich dad poor dad book review ppt - Surface area volume ratio - Toyota weaknesses 2018 - Journal Article Summaries/Evaluation - Unit I Assessment , Unit II Journal - Diametral pitch of gear formula - Kenneth frampton ten points on an architecture of regionalism - Blue coat wan optimization - I-O Certification - Slaughterhouse five chapter 7 summary - Body of evidence trutv - What does rcd stand for in penn foster - Molson canadian marketing - Thank you esther forbes - Cpc homework - Qualified thrift lender test - Alice dreger is anatomy destiny - Comprehensive soap note example nurse practitioner - English 9 research paper - My big fat greek wedding reflection - Gcse pe skeletal system - Weaseler definition - Battery powered cooling vest - Advantages and disadvantages of posttest only design - Business 313 - How many electrons are in potassium outer shell - COSO framework of internal controls - A company is considering building a bridge across a river - Finding the inverse of a quadratic function - 17 3 as a mixed number - Taming the anger monster by anne davidson - The cost of an asset less accumulated depreciation equals - Excel for supply chain management - Presentation - Discussion: Why Employees Stay - TCOM_5403 - Why did roy kill tyrell - Circuit board fabricators case study answers - Jb hi fi phone warranty - Capstone Analysis - Accounting - Which advancement helped singers develop a more intimate singing style - Biosensors international investor relations - Conflict in hamlet act 1 scene 1 - Soap opera david ives analysis - Swot analysis emergency department - Legal,Ethical & Social Environment - 1890 guy metals drive hammond wi 54015 - Business - Paradise malt biscuits iga - A 1000 kg car moving at 20m s slams - Ma clinical psychology unisa - Creating a new position at work - Catherine helen motter vet - River system worksheet answers - Which one of the following statements about forecasting is false - How to find rm in capm - Criticize snidely crossword puzzle clue - Leccion 5 contextos activities answers