Database Management System Lecture 4 The Relational Database Model- Introduction, Relational...

22
Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts

Transcript of Database Management System Lecture 4 The Relational Database Model- Introduction, Relational...

Page 1: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Database Management System

Lecture 4

The Relational Database Model-

Introduction, Relational Database Concepts

Page 2: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Introduction

• In this lesson, an introduction to the relational database model is provided.

• Description of the main building blocks of a relational database and its definition.

Page 3: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Learning Outcomes

• Understand how a relation (table) is the main organization unit of a database.

• Understand the main building blocks of a relational database and its definition

Page 4: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Terminology

• Domain A set of values that define the value range for an attribute.

• Attribute The basic unit in a relation (table) definition. Each attribute has a domain associated with it.

Page 5: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Terminology (Cont.)

• Relation Schema (Table Schema) Defines the structure of a relation (table) which consists of a set of attributes and an association between each attribute and its domain

• Relational Database Schema A collection of relation (table) schemas

Page 6: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Terminology (Cont.)

• Tuple (record/row) A list of values with each value being an element in a domain or NULL. A tuple represent a record or row in a table (relation).

• Relation (Table) An instance of a relation schema which is composed of a set of tuples

Page 7: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Terminology (Cont.)

• Database A collection of relations (tables).

Page 8: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Introduction to the Relational Database Model

• As discussed in the previous lecture, the relational database model is the most widely used data model in DBMSs.

• It was developed by E. F. Codd at IBM in 1970.

Page 9: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Introduction to the Relational Database Model (Cont.)

• The relational database model is based on organizing data with the basic organization unit being a relation that is represented as a table.

Page 10: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Relational Database Concepts

Domain: • is a set of values that define the value range

for an attribute.

• A domain can be considered as a data type. Examples of domains include integer, float, string, date, etc.

Page 11: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Relational Database Concepts (Cont.)

• Relation Schema (Table Schema): defines the structure of a relation (table) which consists of a set of attributes and an association between each attribute and its domain (specifying the possible values of an attribute).

• Relational Database Schema: that is a collection of relation (table) schemas.

Page 12: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Relational Database Concepts (Cont.)

Attribute: • is the basic unit in a relation (table) definition.

• Each attribute has a domain associated with it. It can be considered as a column in relational database table.

Page 13: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Relational Database Concepts (Cont.)

• Tuple (Record/row): • that is a list of values with each value being an

element in a domain or NULL.

• A tuple represent a record or row in a table (relation).

Page 14: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Relational Database Concepts (Cont.)

Relation (Table):• is one instance of a relation schema which is

composed of a set of tuples.

Relational Database:• is a collection of relations (tables).

Page 15: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.
Page 16: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

• Figure 5.1 illustrates the definition of Library database.

• A database schema is defined which consists of two relation (table) schemas: Books and Members.

• As shown in the books table schema in Figure 5.1, the schema defines the structure of the table specifying the attributes of the table (book_Id, title, author, publisher and publication_date).

Page 17: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

• Each attribute is associated with a domain in the schema, e.g. attribute title has domain text which specifies that values of attribute title are of type text.

Page 18: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.
Page 19: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

• Figure 5.2 illustrates the library database instance.

• It can be seen that the library database consists of two relations (tables): books and members.

• The books table is an instance of the books table schema shown in Figure 5.1.

Page 20: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

• The books table consists of tuples (records/rows).

• Each tuple is composed of values for the attributes defined in the table schema.

Page 21: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

• Each value in a table tuple is part of the domain associated with the corresponding attribute in the table schema.

• For example, value ‘A Tale of Two Cities’ in the 1st tuple of the book table is a value of attribute title with domain text as defined in the table schema (shown in Figure 5.1).

Page 22: Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.

Summary

• An Introduction to the Relational Database Model

• The main relational database concepts.