0% found this document useful (0 votes)
42 views24 pages

Lec 5 - IDB

The document provides an introduction to relational database management systems and the relational model. It discusses the differences between DBMS and RDBMS, defines key concepts of the relational model including tables, tuples, relations, attributes, and relation keys. The document is presented as part of a lecture on relational databases.

Uploaded by

Zahoor ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views24 pages

Lec 5 - IDB

The document provides an introduction to relational database management systems and the relational model. It discusses the differences between DBMS and RDBMS, defines key concepts of the relational model including tables, tuples, relations, attributes, and relation keys. The document is presented as part of a lecture on relational databases.

Uploaded by

Zahoor ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Balochistan University of Information Technology, Engineering & Management Sciences

Introduction to
Database Systems
Mohammad Imran
Lecturer
Department of Information Technology
Balochistan University of Information Technology, Engineering & Management Science

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 1
Balochistan University of Information Technology, Engineering & Management Sciences

Lecture 5
Relational Data Model

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 2
Balochistan University of Information Technology, Engineering & Management Sciences

Difference between DBMS and RDBMS


• Every RDBMS is a DBMS but opposite is not true
• RDBMS is a DBMS which is based on the relational model,
but not every DBMS must be relational
• RDBMS are most common, sometimes the term DBMS is
used to denote a RDBMS which is NOT relational,
depends upon the context

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 3
Balochistan University of Information Technology, Engineering & Management Sciences

Difference between DBMS and RDBMS


RDBMS DMBS
• RDBMS (relational database • DBMS applications store
management system) data as files
applications store data in a
tabular form

Does that mean there are no tables in a DBMS?


There can be, but there will be no “relation” between the tables, like in a RDBMS

4
Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 4
Balochistan University of Information Technology, Engineering & Management Sciences

Difference between DBMS and RDBMS


RDBMS DBMS
• Tables will have an identifier called • No Primary Key Concept in
primary key
• Data values will be stored in the form of
DBMS
tables • No Relationship
• The relationships between data values
will be stored in the form of a table • Accessibility is difficult
• Every value stored is accessible • Updating is difficult
• Value can be updated by the system
• The data in this system is also physically
• Dependency is there
and logically independent • No Data Normalization
• Data Normalization

5
Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 5
Balochistan University of Information Technology, Engineering & Management Sciences

Difference between DBMS and RDBMS


• You can say that a RDBMS is an in an extension of a DBMS, even if
there are many differences between the two
• Most software products in the market today are both DBMS and
RDBMS compliant
• Essentially, they can maintain databases in a (relational) tabular
form as well as a file form, or both
• Today a RDBMS application is a DBMS application, and vice versa
• Still major differences between a relational database system for
storing data and a plain database system
Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 6
Balochistan University of Information Technology, Engineering & Management Sciences

RDBMS
• Relational Database Management System
• Based on Relational Model
• So lets see what a relational model is

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 7
Balochistan University of Information Technology, Engineering & Management Sciences

Relational Model
• Edgar Frank Codd (aka E.F. Code)
• (19 August 1923 – 18 April 2003)
• English computer scientist, Worked for IBM
• Invented the relational model for database
management, basis for relational databases
• Made valuable contributions to computer
science
• Relational model, a very influential general
theory of data management, remains his
most mentioned achievement

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 8
Balochistan University of Information Technology, Engineering & Management Sciences

Relational Model
• Primary data model, which is used widely around the
world for data storage and processing
• Model is simple and it has all the properties and
capabilities required to process data with storage
efficiency

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 9
Balochistan University of Information Technology, Engineering & Management Sciences

Relational Model Concepts


• Tables
• Tuple
• Relation Instance
• Relation Schema
• Relation Key
• Attribute Domain

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 10
Balochistan University of Information Technology, Engineering & Management Sciences

Tables
• In relational data model, • A Table
relations are saved in the
format of Tables CMS-ID Name Session Phone

• This format stores the 123456 Ali Spring 15 1111-


1111111
relation among entities
789456 Saira Fall 13 2222-
• A table has rows and 2222222
columns, where rows 654321 Karim Fall 12 3333-
represents records and 3333333

columns represent the


attributes

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 11
Balochistan University of Information Technology, Engineering & Management Sciences

Tuple
• A single row of a table, • Tuple: highlighted in Red
which contains a single
CMS-ID Name Session Phone
record for that relation is
123456 Ali Spring 15 1111-
called a tuple 1111111

789456 Saira Fall 13 2222-


2222222
654321 Karim Fall 12 3333-
3333333

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 12
Balochistan University of Information Technology, Engineering & Management Sciences

Relation Instance
• A finite set of tuples in • Relation Instance: highlighted in Red
the relational database
CMS-ID Name Session Phone
system represents
123456 Ali Spring 15 1111-
relation instance 1111111

Relation instances do 789456 Saira Fall 13 2222-


2222222
not have duplicate 654321 Karim Fall 12 3333-
tuples 3333333

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 13
Balochistan University of Information Technology, Engineering & Management Sciences

Relation Schema
• A relation schema describes
o relation name (table name)
o attributes, and their names

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 14
Balochistan University of Information Technology, Engineering & Management Sciences

Relation (Table), Attributes & Tuple

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 15
Balochistan University of Information Technology, Engineering & Management Sciences

Relation Key
• Each row has one or • Relation Key: highlighted
more attributes, known
CMS-ID Name Session Phone
as relation key, which
123456 Ali Spring 15 1111-
can identify the row in 1111111

the relation (table) 789456 Saira Fall 13 2222-


2222222
uniquely 654321 Karim Fall 12 3333-
3333333

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 16
Balochistan University of Information Technology, Engineering & Management Sciences

Attribute domain
• Every attribute has some pre-defined value scope, known
as attribute domain
o Age (1-99)
o Married (yes or no)

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 17
Balochistan University of Information Technology, Engineering & Management Sciences

Constraints
• Every relation has some conditions that must hold for it to
be a valid relation
• These conditions are called Relational Integrity
Constraints
• There are three main integrity constraints:
o Key constraints
o Domain constraints
o Referential integrity constraints
Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 18
Balochistan University of Information Technology, Engineering & Management Sciences

Key Constraints
• There must be at least one minimal subset of attributes in the relation,
which can identify a tuple uniquely
• This minimal subset of attributes is called key for that relation
• If there are more than one such minimal subsets, these are called
candidate keys
• Key constraints force that
o in a relation with a key attribute, no two tuples can have identical values
for key attributes
o a key attribute can not have NULL values.
• Key constraints are also referred to as Entity Constraints

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 19
Balochistan University of Information Technology, Engineering & Management Sciences

Domain Constraints
• Attributes have specific values in real-world scenario
o For example, age can only be a positive integer
• Same constraints have been tried to employ on the
attributes of a relation
• Every attribute is bound to have a specific range of values
o For example
• age cannot be less than zero
• telephone numbers cannot contain a digit outside 0-9

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 20
Balochistan University of Information Technology, Engineering & Management Sciences

Referential Integrity Constraints


• Referential integrity constraints work on the concept of
Foreign Keys
• A foreign key is a key attribute of a relation that can be
referred in other relation
• Referential integrity constraint states that if a relation
refers to a key attribute of a different or same
relation, then that key element must exist

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 21
Balochistan University of Information Technology, Engineering & Management Sciences

No Referential Integrity here

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 22
Balochistan University of Information Technology, Engineering & Management Sciences

Relational Model

Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015 23
Balochistan University of Information Technology, Engineering & Management Sciences

Thank you

24
Introduction to Database Systems Spring 2015 Mohammad Imran April 21, 2015

You might also like