chapter 2 relational data model. definition of database shared collection of logically related data...

66
CHAPTER 2 RELATIONAL DATA MODEL

Upload: ethelbert-wood

Post on 20-Jan-2016

223 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

CHAPTER 2

RELATIONAL DATA MODEL

Page 2: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

DEFINITION OF DATABASE

Shared collection of logically related data (and a description of this data), designed to meet the information needs of an organization.

Page 3: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RDBMS

Relational Database Management System (RDBMS) is a database base on the relational model developed by Dr. E.F. Codd of IBM Research in 1970.

A DBMS that manages the relational database.

Page 4: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

The model represent data in form of table.

Page 5: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

COMPONENTS & CHARACTERISTICS OF RDBMS

RELATIONIs a table with column and rowsA relation(table) consists of unique attributes

(column) and tuples (rows)

ATTRIBUTE (FIELD)An attribute is named column of relationUsed to hold information about the objects to be

represented in database

RECORD (TUPLE)A record is a row of a relation

Page 6: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

COMPONENTS & CHARACTERISTICS OF RDBMS

DOMAINA domain is the set of allowable values for one

or more attributes

DEGREEThe degree of relation is the number of

attributes it containsRelationship degree: The number of entities

associated with the relationship.

Page 7: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

CARDINALITY• The cardinality of relation is the number of

rows it contain.

• Relationship cardinality: Express the specific number of entity occurrences associated with occurrences of the related entity

•In data modelling terms, cardinality is how one table relates to another.1-1 (1:1) (one row in table A relates to one row in tableB) 1-Many (1:m) (one row in table A relates to many rows in tableB)Many-Many (m:n) (Many rows in table A relate to many rows in table B)

Page 8: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

COMPONENTS & CHARACTERISTICS OF RDBMS

Page 9: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATION INSTANCE Relation: made up of 2 parts:

1. SCHEMA : specifies name of relation, plus name

and type of each columnE.G.Student(sid: char(10), name: char(20), age: integer, gpa: real, login: char(20)).

2. INSTANCE : a table of values in rows and columns Relation instance is a set of rows (tuples, records) As a set, it is not supposed to have duplicates!

Page 10: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATION KEYSThere are no duplicate tuples within a relation.

Therefore, we need to be able to identify one or more attributes (called relational keys) that uniquely identifies each tuple in a relation.

There are several types of relational keys;Primary KeyCandidates KeyForeign Key

Page 11: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATION KEYSPRIMARY KEY

is a column (or columns) in a table that uniquely identifies the rows in that table.

For example, in the table above, CustomerNo is the primary key.

The values placed in primary key columns must be unique for each row: no duplicates can be tolerated. In addition, nulls are not allowed in primary key columns.

Page 12: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATION KEYSCANDIDATES KEY

is a column that meets all of the requirements of a primary key. In other words, it has the potential to be a primary key.

Page 13: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATION KEYSFOREIGN KEY

are columns that point to primary key columns.

So, for example, OrderNo is the primary key of the table ORDERS below and CustomerNo is a foreign key that points to the primary key in the CUSTOMERS table.

Page 14: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet
Page 15: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Integrity RulesRules of constraints or restrictions that apply to

all instances of the database.

A feature provided by relational database management system (RDBMS), which prevents users or applications from entering inconsistent data.

There are 2 types of integrity rules;Entity IntegrityReferential Integrity

Page 16: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

INTEGRITY RULESENTITY INTEGRITY

No attribute of a primary key can be null.

If we allow null for any part of primary key, we are implying that not all the attributes are needed to distinguish between tuples.

NULLNull mean that no value has yet been supplied.Null not the same with zero numeric value or

text string filled with spaces; zeros and spaces are values

A null represent the absence of a value.

Page 17: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

INTEGRITY RULESREFERENTIAL INTEGRITY

This rule applies to a foreign keys.

If a foreign key exist in a relation, either the foreign key value must match a candidate key value of some tuples in its home relation or the foreign key value must be wholly null.

A table which has a foreign key referring to its own candidate key is known as self-referencing table.

Page 18: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

DATABASE DESIGN TECHNIQUE• ER diagram is widely used in database design

– Represent conceptual level of a database system

– Describe things and their relationships• ERD is a top-down approach to database

design.• ERD consists 3 basic concepts: - Entity - Attribute - Relationship

Page 19: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Entity• Relational database design starts by defining the

required entities• Entities are set of object you want to store data

about– people (students, customers, employees, etc.)– places (resorts, cities, countries, restaurants

etc.)– things (products, invoices, movies, paintings,

books, buildings, contracts, etc.)– events (elections, presentations, earthquakes,

etc.)• Represented by a rectangular box

EntityName

Page 20: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

AttributeAttribute hold values that describe the properties

of entitiesE.g. student entity could have attributes

such as name, address, DOB etc.•Each entity has one or more attributes

associated with it.•Represented by a ellipse

Attribute Name

Page 21: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Types of Attributes Definition Example

Simple attribute Cannot be divided into simpler components

Gender of the employee

Composite attribute Can be split into components

Address of the employee

Single valued Can take on only a single value for each entity instance

Age of the employee

Multi values Can take up many values

Skill set of the employee

Stored attribute Attribute that need to be stored permanently

Date of joining of the employee

Derived attribute Attribute that can be calculated based on other attributes

Years of the service of the employee

Type of Attributes

Page 22: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Composite Attribute

EMPLOYEEEmpNo

EmpName

Designation

DOB

Building

Street

Address

Poscode

State

Page 23: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

MULTI VALUED ATTRIBUTE

EMPLOYEEEmpNo

EmpName

Designation

DOB

Building

Street

Address

Poscode

State

Skill

Page 24: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

STORED & DERIVED ATTRIBUTE

EMPLOYEEEmpNo

EmpName

Designation

Building

Street

Address

Poscode

State

DateEmployed

YearsEmployed

Page 25: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

ATTRIBUTES OF A RELATIONSHIP

VENDORRAW

MATERIALSSuppli

es

VendorID VendorNa

me

VendorAddress

MaterialID MaterialNa

me

StandardCost

SupplyUnitPrice

Page 26: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATIONSHIP• Relationship specify the relations among entities Relationship specify the relations among entities

from two or more entity setsfrom two or more entity sets• Describe a meaningful interaction between entity.Describe a meaningful interaction between entity.• Represented by a diamond

Relationship Name

Page 27: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Degree of Relationship• Relationship degree: The number of entities

associated with the relationship. Degree: the number of entity types involved One Unary Two Binary Three Ternary

Page 28: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Types of Relationship Degrees1. Unary Relationship

– exist when an association is maintained within a single entity

- also known as RECURSIVE RELATIONSHIP

Page 29: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Types of Relationship Degrees2. Binary Relationship

– exist when 2 entities are associated

Page 30: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Types of Relationship Degrees2. Ternary Relationship

– exist when 3 entities are associated

Page 31: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATIONAL MODEL RELATIONSHIPS

Relationship Cardinality: Express the specific number of entity occurrences associated with occurrences of the related entity

There are 3 types of relationships;One to One (1:1)One to Many (1:M)Many to One (M:1)Many to Many (M:N)

Eg;Employee is assigned to parking place (1:1)Department offers course (1:M)Employee work in department (M:1)Employee is assigned to project (M:N)

Page 32: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATIONAL MODEL RELATIONSHIPS

ONE TO ONE (1:1)One occurrence of an entity relates to only

one occurrence in another entity

A B

1 1

Page 33: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATIONAL MODEL RELATIONSHIPS

ONE TO MANY (1:M)– One occurrence in an entity relates to many

occurrences in another entity.

A

B1

B2

B3

M1

Page 34: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATIONAL MODEL RELATIONSHIPS

MANY TO ONE (M:1)many occurrences in an entity relate to one

occurrences in another entity

AB2

B3

B1

1M

Page 35: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATIONAL MODEL RELATIONSHIPSMANY TO MANY (M:N)

many occurrences in an entity relate to many occurrences in another entity

B3

B2

B1A1

A2

M N

Page 36: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

STEPS IN ER MODELING:

Identify the entities

Find the relationship

Identify the key attributes for every entities

Identify other relevant attributes

Draw complete ER-modelling with all attributes including primary key

Page 37: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATIONAL ALGEBRARelational algebra is a (high-level) procedural

language associated with the relational model.Basic operations in relational algebra:

Unary Relational Operations: Selection Projection

Cartesian productUnionSet DifferenceIntersectionBinary Relational Operations

Division operations Join

Page 38: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

RELATIONAL ALGEBRA

Page 39: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

5 BASIC OPERATIONSSelection ( ) Selects a subset of rows from

relation (horizontal).

Projection ( ) Retains only wanted columns from relation (vertical).

Cross-product (x) Allows us to combine two relations.

Set-difference (–) Tuples in r1, but not in r2.

Union ( ) Tuples in r1 and/or in r2.

Page 40: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Example InstancesR1 S1

S2

Boats

bid bname color 101 Interlake blue 102 Interlake red 103 Clipper green 104 Marine red

sid bid day

22 101 10/10/96 58 103 11/12/96

sid sname rating age

22 dustin 7 45.0

31 lubber 8 55.5 58 rusty 10 35.0

sid sname rating age 28 yuppy 9 35.0 31 lubber 8 55.5 44 guppy 5 35.0 58 rusty 10 35.0

Page 41: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

SELECT operation ()Used to select a subset of the tuples from a

relation that satisfies a selection condition

Symbol -> σ (sigma)

Syntax : σ<selection condition>( R )

Page 42: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

sid sname rating age 28 yuppy 9 35.0 31 lubber 8 55.5 44 guppy 5 35.0 58 rusty 10 35.0

sname rating yuppy 9 rusty 10

SELECT operation ()

rating

S8

2( )

sname rating rating

S,

( ( ))8

2

Page 43: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

SELECT operation ()Eg1: Select the STUDENT tuples whose Semester is 3.

Eg2: Select the MANAGER tuples whose Salary is greater

than RM25,000.

Eg3: Select the tuples for all SUPERVISOR who either work in IT Department and Salary less than RM20,000 per year, or work in HR Department

and Salary less than RM30,000.

σSem=3(STUDENT)

σSalary>25000(MANAGER)

σ(Dept=“IT” AND Salary<20000) OR Dept=“HR” AND Salary<30000))

(SUPERVISOR)

Page 44: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

PROJECT operation

Select certain columns from the table and discard the other columns

Symbol -> Л (pi)

Syntax – Л <attribute list> (R)

Page 45: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

PROJECT operation

S2 sid sname rating age

28 yuppy 9 35.0 31 lubber 8 55.5 44 guppy 5 35.0 58 rusty 10 35.0

sname rating

yuppy 9 lubber 8 guppy 5 rusty 10

age

35.0 55.5

)2(, Sratingsname

age S( )2

Page 46: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

PROJECT operationEg1: List each student’s Regs.No, First Name and

Last Name.

Eg2: List IDNum, Name and Age of all supervisors who

work in IT department.

ЛRegs.No, Fname,

Lname(STUDENT)

ЛIDNum,Name,Age (σDept=“IT”(SUPERVISOR))

Page 47: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

UNION operationUNION compares tuples in two relations and

create a new relation that contains some of the tuples from each of the input relations.

Symbol -> υ (cup)

R υ S

Page 48: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

UNION operation

S1

S2

sid sname rating age

22 dustin 7 45.0

31 lubber 8 55.5 58 rusty 10 35.0

sid sname rating age 28 yuppy 9 35.0 31 lubber 8 55.5 44 guppy 5 35.0 58 rusty 10 35.0

sid sname rating age

22 dustin 7 45.0 31 lubber 8 55.5 58 rusty 10 35.0 44 guppy 5 35.0 28 yuppy 9 35.0

S S1 2

Page 49: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

UNION operationEg1: List all IDNum where there is either a

Manager or Supervisor for IT Department.

Eg2: List Regs.No for students those register at Department and Hostel.

ЛIDNum(σDept=“IT”(MANAGER)) υ ЛIDNum(σDept=“IT”(SUPERVISOR))

ЛRegs.No(DEPARTMENT) υ ЛRegs.No(HOSTEL)

Page 50: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

CROSS PRODUCT operation• Defines a relation that is the concatenation of

every tuple of relation R with every tuple of relation S.

Denoted by X

R X S

Page 51: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

CROSS PRODUCT operation

R1

S1

sid sname rating age

22 dustin 7 45.0

31 lubber 8 55.5 58 rusty 10 35.0

sid bid day

22 101 10/10/96 58 103 11/12/96

(sid) sname rating age (sid) bid day

22 dustin 7 45.0 22 101 10/ 10/96

22 dustin 7 45.0 58 103 11/ 12/96

31 lubber 8 55.5 22 101 10/ 10/96

31 lubber 8 55.5 58 103 11/ 12/96

58 rusty 10 35.0 22 101 10/ 10/96

58 rusty 10 35.0 58 103 11/ 12/96

R1 X S1

Page 52: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

CARTESIAN PRODUCT operationEg1: List the Regs.No, Name and NRIC of all

students who registred CourseID, CourseName for

course.ЛRegs.No,Name,NRIC(Student) X (Л Regs.No,CourseID,

CourseName(Course))

Page 53: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

INTERSECTION operationDefines a relation consisting of the set of all

tuples that are in both R and S.

Symbol -> ∩ (cap)

R ∩ S

Page 54: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

INTERSECTION operation

S1S2

sid sname rating age 31 lubber 8 55.5 58 rusty 10 35.0

sid sname rating age

22 dustin 7 45.0

31 lubber 8 55.5 58 rusty 10 35.0

sid sname rating age 28 yuppy 9 35.0 31 lubber 8 55.5 44 guppy 5 35.0 58 rusty 10 35.0

S S1 2

Page 55: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

INTERSECTION operationEg1: List Regs.No for students those having

register at both Department and Hostel.

ЛRegs.No(DEPARTMENT) ∩ ЛRegs.No(HOSTEL)

Page 56: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

SET DIFFERENCE operationDefines a relation consisting of the tuples that

are in relation R, but not in S.

Symbol -> - (minus)

R - S

Page 57: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

SET DIFFERENCE operation

S1 S2

sid sname rating age

22 dustin 7 45.0

31 lubber 8 55.5 58 rusty 10 35.0

sid sname rating age 28 yuppy 9 35.0 31 lubber 8 55.5 44 guppy 5 35.0 58 rusty 10 35.0

sid sname rating age

22 dustin 7 45.0

sid sname rating age 28 yuppy 9 35.0 44 guppy 5 35.0

cS S1 2S2 – S1

Page 58: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

SET DIFFERENCE operationEg1: List Regs.No for students those register at Department but no at Hostel.

ЛRegs.No(σcourse=“DNS3A”(DEPARTMENT)) – ЛRegs.No(σcourse=“DNS3A”(HOSTEL))

Page 59: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

JOIN operation

Compute R X S

Select rows where attributes that appear in both relations have equal values

Project all unique atttributes and one copy of each of the common ones.

Page 60: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

NATURAL JOIN operation

R1

S1

sid sname rating age bid day

22 dustin 7 45.0 101 10/10/9658 rusty 10 35.0 103 11/12/96

sid sname rating age

22 dustin 7 45.0

31 lubber 8 55.5 58 rusty 10 35.0

sid bid day

22 101 10/10/96 58 103 11/12/96

cR1 S1

Page 61: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

Natural JoinThe tuples in the resulting relation are

obtained by combining tuples in the operands with equal values on the common attributes.

The common attributes often form a key of one of the operands (remember: references are realized by means of foreign keys, and we join in order to follow references)

Page 62: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

OUTER JOIN“Pads With Nulls”A variant of the join, to keep all pieces of

information from the operands.Three Variants :

Left – only tuples of the left operand are padded.

Right – only tuples of the right operand are padded.

Full – tuples of both operands are padded

Page 63: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

R1

R2

Employee Department

Smith Sales

Black Production

White Production

Department Head

Production Mori

Purchasing Brown

Page 64: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

OUTER LEFT JOINR1 LEFT R2 EMPLOYEE DEPARTMEN

THEAD

Smith Sales Null

Black Production Mori

White Production Mori

Page 65: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

OUTER RIGHT JOINR1 RIGHT R2

EMPLOYEE DEPARTMENT

HEAD

Black Production Mori

White Production Mori

Null Purchasing Brown

Page 66: CHAPTER 2 RELATIONAL DATA MODEL. DEFINITION OF DATABASE Shared collection of logically related data (and a description of this data), designed to meet

OUTER FULL JOINR1 RIGHT R2

EMPLOYEE DEPARTMENT

HEAD

Smith Sales Null

Black Production Mori

White Production Mori

Null Purchasing Brown