Understanding Relational Data Model: Entity Sets to Relations and Table Combination, Slides of Database Management Systems (DBMS)

An introduction to the relational data model, explaining what a relation is, the concept of schemas, and the benefits of using relations. It also covers the process of converting entity sets and relationships into relations, and discusses the risks and solutions for handling many-many relationships and weak entity sets. Examples are given to illustrate the concepts.

Typology: Slides

2012/2013

Uploaded on 04/26/2013

divyesh
divyesh 🇮🇳

4.2

(6)

83 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
The Relational Data Model
1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Understanding Relational Data Model: Entity Sets to Relations and Table Combination and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

The Relational Data Model

A Relation is a Table

name manf

Snickers M&M/Mars

Twizzlers Hershey

Candies

2

Attributes (column headers)

Tuples (rows)

Why Relations?

• Very simple model.

• Often matches how we think about data.

• Abstract model that underlies SQL, the most

important database language today.

From E/R Diagrams to Relations

• Entity set -> relation.

  • Attributes -> attributes.

• Relationships -> relations whose attributes are

only:

  • The keys of the connected entity sets.
  • Attributes of the relationship itself.

Relationship -> Relation

7

Con- sumers Likes Candies

Likes(consumer, candy)

Favorite

Favorite(consumer, candy)

Married

husband

wife

Married(husband, wife)

name addr name manf

Buddies

Buddies(name1, name2)

Combining Relations

• OK to combine into one relation:

1. The relation for an entity-set E

2. The relations for many-one relationships of

which E is the “many.”

• Example: Consumers(name, addr) and

Favorite(consumer, candy) combine to make

Consumer1(name, addr, favCandy).

Handling Weak Entity Sets

• Relation for a weak entity set must include

attributes for its complete key (including those

belonging to other entity sets), as well as its

own, nonkey attributes.

• A supporting relationship is redundant and

yields no relation (unless it has attributes).

Example

11

Logins At Hosts

name name

Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName, hostName2)

Must be the same

billTo

At becomes part of Logins

location

Example

13

Candies

Choc- olates

isa

name (^) manf

color

Object-Oriented

14

name manf Twizzler Hershey Candies

name manf color Snickers M&M/Mars light Chocolates

Good for queries like “find the color of chocolate candies made by M&M/Mars.”

Using Nulls

16

name manf color Twizzler Hershey NULL Snickers M&M/Mars dark Candies

Saves space unless there are lots

of attributes that are usually NULL.