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

21-29 central ave thornleigh nsw 2120 - Elements of performing arts ppt - Case Analysis: The Decision-Making Process - Information Technology - Number of primes less than 10000 - Weekly discussion 5 - Accounting formula assets liabilities equity - What is a market product grid - Macbeth act 3 discussion questions answers - Revex s20 coaxial switch price - Glenn flothe alaska state trooper - CPT Final Narrative paper - Railway engineering questions and answers - Mettm - Db file sequential read tuning - Https youtu be lp eo5i60ka - Anatomy of wrist - Fedscope - Controversial or sensitive issue - The effects on international trade - Smartie cookies on sticks - St mary's graduation 2020 - Electron transport chain photosynthesis animation - From bottom to top how one provider retooled its collections - Joy luck club questions - Three questions need three separate answers this is not a paper. - Personal Statement to get into school - How to name esters - Combination probability problems with solutions - Breach of duty notice - Codes of conduct for nurses - 1a farnham street parnell - How is the energy value of foods determined - Comparison of the DNP and PhD Roles in Nursing - Born a crime figurative language - Metro 2033 book pdf - Interpersonal messages communication and relationship skills pdf - Reading summary - D3 collapsible network graph - Infograph and 400-550 word letter - Leadership Practices - What's driving porsche case study - Unit 40 international marketing assignment - Economic Concentration Evaluation - +91[]*9414601882 lOvE prOblEm sOlutiOn mumbai vashikaran - Loanhead primary school website - Dependency between change management and configuration management - Exercise 12 1 indirect cash flow classification lo c1 - Temperature time graph specific heat capacity - Gas evolution reaction - I tituba black witch of salem chapter summary - Acca per sign off - What is the role & importance of Hospitality & Guest service in hospitality industry - Need help with my final project - 4 pages MLA format essay - Access data registry viewer - Nightingale's 13 canons for nursing practice - Lightest element in period 3 - C & k property management - Christopher pettiet cause of death - The gangster we are all looking for chapter 4 summary - Principles of advocacy in nursing - Paper - Hudson community college esl - True false making data secure means keeping it secret - Student everest online cci - 3 quarter crown preparation - Ancient greece zoom background - A salesperson contacts eight potential customers - When was the seagull written - Paper on COSO framework - Nursing diagnosis for orif - C11 Week 3 Threaded Discussion - Critical Reasoning week 7 course project - Discussion - Fish cheeks by amy tan - We live as we dream alone meaning - Week 10 - Bible story comic strip - Organisational culture model by harrison 1993 - Milestones in language and literacy chart - ET WK6 paper - History of Public Health worldwide - How to make a hot pack with calcium chloride - Johns reflective model 2004 - Hollanders model of personality - Art-labeling activity: the structure of the epidermis - The ontological argument essay - Busineess managment - Next generation portable gaming console - Built by science bodybuilding pdf - Emerging threats and countermeasures - A function has the following properties - The success profiler personal skills map - Was it necessary to re formulate new coke - Nursing care plan for impaired gas exchange in newborn - Forensic files vicky lyons died - Case Study: Bullying – The Amanda Todd Story - Temple physics lab - Functions of National Security Plans