SlideShare a Scribd company logo
INT306
Database Management Systems
OTHER DATA MODELS
Text book

Database System Concepts
A. Silberschatz, H. F. Korth, S. Sudarshan

Course Instructor

Mr. Sumit Mittu

Assistant Professor and Placement Coordinator, CSE/IT
Lovely Professional University, Punjab (India)

sumit.12735@lpu.co.in sumit.mittu@gmail.com
http://tinyurl.com/askSumit
01-03-2014 11:29:39
IN THIS CHAPTER
•
•
•
•

object oriented model
network model
hierarchical model
relational model

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

2
OBJECT ORIENTED DATA MODEL
• Need for complex data types
• Object Oriented Data Model
• Object Structure
• An object encapsulates set of variables, messages & methods

• Object Classes
• Inheritance
• Class hierarchies and Multiple inheritance

• Object Identity
• Name, value and built-in

• Object Containment
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

3
OBJECT ORIENTED DATA MODEL
• Object Relational (OR) Model
• Implementation in SQL (most basic implementation)
• Create an Object Type
• CREATE TYPE Engineering AS
OBJECT (Name VARCHAR(10), Roll NUMBER(8), Program VARCHAR(10));

• Create a table of objects/types
• CREATE TABLE Students OF Engineering;

• Now you can fire any queries on Stduents table just like the way
do on any other table. E.g.
•
•
•
•

DESCRIBE Students;
INSERT INTO Students Values('Priya', 25,'M.Tech');
INSERT INTO Students(Name, Program) VALUES('Kunal','B.Tech');
SELECT * FROM Students WHERE Roll IS NULL;

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

4
NETWORK MODEL
• A network database is a collection of records
connected to one another through links
• A record is equivalent to an entity in the E-R model
• A field/attribute in record contains only one data value
• A link is an association between precisely two records

• Data Structure Diagram
• Defined as the schema representing design of network
database
• Boxes represent record types, lines represent links
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

5
NETWORK MODEL
type

customer = record
customer-name: string;
customer-street: string;
customer-city: string;

01-03-2014 11:29:41

type

account = record
account-number: integer;
balance: integer;

Sumit Mittu, Assistant Professor, CSE/IT

6
NETWORK MODEL

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

7
NETWORK MODEL
• (a) One to many relationship
• (b) One to one relationship

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

8
NETWORK MODEL
• One to one

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

9
NETWORK MODEL
• Many to many

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

10
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

11
NETWORK MODEL

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

12
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

13
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

14
NETWORK MODEL
• Mapping of Networks to Files

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

15
NETWORK MODEL
• Mapping of Networks to Files – Ring structure

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

16
SCRATCH YOUR MIND!!!
•

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

17
HIERARCHICAL MODEL
• A hierarchical database is a collection of records
connected to one another through links
• The basic concepts are similar to network model but…
• Hierarchical Model supports only 1:1 and 1:N relationships
• Network Model supports 1:1, 1:N, N:1 as well as M:N relationships

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

18
HIERARCHICAL MODEL
• Tree Structure Diagram
• Defined as the schema representing design of hierarchical
database
• The single instance of a database tree
• The root of this tree is a dummy node
• The children of that node are actual instances of the
appropriate record type

• Boxes represent record types, lines represent links
• Record organised as rooted trees called database tree
• No cycles in underlying graphs
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

19
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

20
HIERARCHICAL MODEL

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

21
HIERARCHICAL MODEL
• M:N relationship

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

22
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

23
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

24
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

25
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

26
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

27
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

28
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

29
HIERARCHICAL MODEL
• Virtual Records
• It contains no data value
• It contains a logical pointer to a physical record
• Helps to overcome drawbacks raised due to replication
• Data inconsistency during update operations
• Waste of space due

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

30
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

31
HIERARCHICAL MODEL
• Mapping of Hierarchies to Files
• Implementation with parent-child pointers

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

32
HIERARCHICAL MODEL
• Mapping of Hierarchies to Files
• Implementation with leftmost-child and next-sibling pointers

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

33
HIERARCHICAL MODEL
• Mapping of Hierarchies to Files
• Implementation with pre-order threads

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

34
SCRATCH YOUR MIND!!!
•

•

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

35
RELATIONAL MODEL
• Uses a collection of tables to represent both the
data and relationships among those data
• Relation/Tables
• Tuples/Records/rows of a table
• Attributes/Fields/columns of a table
• Domain of an attribute
• Atomic Domain
• NULL values

• Relation Schema (and Database Schema)
• Relation Instance (and Database Instance)
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

36
RELATIONAL MODEL
• A1, A2, …, An are attributes
• R = (A1, A2, …, An) is a relation schema
• Example:
• instructor = (ID, name, dept_name, salary)

• Formally, given sets D1, D2, …. Dn, a relation r is a subset of
• D1 x D2 x … x Dn

• Thus, a relation is a set of n-tuples (a1, a2, …, an) where each ai  Di

• The current values (relation instance) of a relation are

specified by a table
• An element t of r is a tuple, represented by a row in a table
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

37
RELATIONAL MODEL
• Relational Database is based on Relational Model
• Collection of tables, each of which has a unique name
• The order of tuples in a relation (table) is irrelevant
• The order of attributes in a relation is irrelevant
• Keys:
• Super key, candidate key, primary key (entity integrity constraint)
• Foreign key (referential integrity constraint)
• Referencing relation and Referenced relation

• Also includes a DDL and DML
• Primarily SQL for data definition and manipulation
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

38
RELATIONAL MODEL

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

39
RELATIONAL MODEL
• Relational Database Design
• Database consists of multiple relations that contain
information about and enterprise broken up into multiple
parts
• Instructor, Student, Advisor, etc.

• Bad Design
• Repetition of information
• Missing information (due to null values)

• Normalization is required to generate good design
• Schema Diagrams
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

40
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

41
RELATIONAL MODEL
• DDL
• SQL Commands:
• CREATE, ALTER, DROP, RENAME, DESC or DESCRIBE

• DML
• Procedural
• PL/SQL Code blocks

• Declarative (Non-procedural) – Query language
• SQL Commands:
• SELECT, INSERT, UPDATE, DELETE

• Embedded SQL:
• Application programs, OLEDB/ODBC drivers, DML Pre-compilers, etc.

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

42
RELATIONAL MODEL
• Other Relational Query Languages
• Procedural v/s Non-procedural(declarative)
• “Pure” Languages
• Relational Algebra
• Relational Calculus
• Tuple Relational Calculus
• Domain Relational Calculus

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

43
RELATIONAL MODEL
• Relational Algebra Operations
•
•
•
•

Selection
Projection
Cartesian Product
Joins
• Natural join, Inner Join, Theta Join, Self Join
• Outer Join (Left / Right / Full)

• Set Operations
• Union, Intersection, Difference

• Rename, Division, etc.
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

44
01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

45
SCRATCH YOUR MIND!!!
•

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

46
RELATIONAL MODEL
• Tuple Relational Calculus
• Non procedural query language
• Queries expressed as:
• { t | P(t) }

• Example queries
• { t | t є instructor ^ t[salary] > 5000 }
• { t |∃ s є instructor (t[id] = s[id] ^ s[salary] > 8000) }
• { t | ¬ (t є instructor) }

01-03-2014 11:29:41

Sumit Mittu, Assistant Professor, CSE/IT

47
RELATIONAL MODEL
• Domain Relational Calculus
• Non procedural query language
• Queries expressed as:
• { <x1, x2,..xn> | P(x1, x2,…,xn) }

• Example queries
• { <i, n, s> | <i, n, s> є instructor ^ s > 5000 }
• i, n and s represent the id, name and salary columns of instructor table

01-03-2014 11:29:40

Sumit Mittu, Assistant Professor, CSE/IT

48

More Related Content

Similar to Int306 03

Database architecture and Data modelling
 Database architecture and Data modelling Database architecture and Data modelling
Database architecture and Data modelling
ViswanathanS21
 
Entity relationship modelling - DE L300
Entity relationship modelling - DE L300Entity relationship modelling - DE L300
Entity relationship modelling - DE L300
Edwin Ayernor
 
week1-thursday-2id50-q2-2021-2022-intro-and-basic-fd.ppt
week1-thursday-2id50-q2-2021-2022-intro-and-basic-fd.pptweek1-thursday-2id50-q2-2021-2022-intro-and-basic-fd.ppt
week1-thursday-2id50-q2-2021-2022-intro-and-basic-fd.ppt
RidoVercascade
 
ERD.ppt
ERD.pptERD.ppt
ERD.ppt
ERD.pptERD.ppt
Introduction to computers
Introduction to computersIntroduction to computers
Introduction to computers
nirupam16
 
Introduction to Data Analytics with R
Introduction to Data Analytics with RIntroduction to Data Analytics with R
Introduction to Data Analytics with R
Wei Zhong Toh
 
A critical review of literature in the kenyan context
A critical review of literature in the kenyan contextA critical review of literature in the kenyan context
A critical review of literature in the kenyan context
eLearning Innovations Conference
 
A critical review of literature in the kenyan context
A critical review of literature in the kenyan contextA critical review of literature in the kenyan context
A critical review of literature in the kenyan context
eLearning Innovations Conference
 
RDBMS Model
RDBMS ModelRDBMS Model
RDBMS Model
Sarmad Ali
 
RDAP14 Poster: Anything but a policy – building institutional support for dat...
RDAP14 Poster: Anything but a policy – building institutional support for dat...RDAP14 Poster: Anything but a policy – building institutional support for dat...
RDAP14 Poster: Anything but a policy – building institutional support for dat...
ASIS&T
 

Similar to Int306 03 (11)

Database architecture and Data modelling
 Database architecture and Data modelling Database architecture and Data modelling
Database architecture and Data modelling
 
Entity relationship modelling - DE L300
Entity relationship modelling - DE L300Entity relationship modelling - DE L300
Entity relationship modelling - DE L300
 
week1-thursday-2id50-q2-2021-2022-intro-and-basic-fd.ppt
week1-thursday-2id50-q2-2021-2022-intro-and-basic-fd.pptweek1-thursday-2id50-q2-2021-2022-intro-and-basic-fd.ppt
week1-thursday-2id50-q2-2021-2022-intro-and-basic-fd.ppt
 
ERD.ppt
ERD.pptERD.ppt
ERD.ppt
 
ERD.ppt
ERD.pptERD.ppt
ERD.ppt
 
Introduction to computers
Introduction to computersIntroduction to computers
Introduction to computers
 
Introduction to Data Analytics with R
Introduction to Data Analytics with RIntroduction to Data Analytics with R
Introduction to Data Analytics with R
 
A critical review of literature in the kenyan context
A critical review of literature in the kenyan contextA critical review of literature in the kenyan context
A critical review of literature in the kenyan context
 
A critical review of literature in the kenyan context
A critical review of literature in the kenyan contextA critical review of literature in the kenyan context
A critical review of literature in the kenyan context
 
RDBMS Model
RDBMS ModelRDBMS Model
RDBMS Model
 
RDAP14 Poster: Anything but a policy – building institutional support for dat...
RDAP14 Poster: Anything but a policy – building institutional support for dat...RDAP14 Poster: Anything but a policy – building institutional support for dat...
RDAP14 Poster: Anything but a policy – building institutional support for dat...
 

More from Sumit Mittu

Int306 00
Int306 00Int306 00
Int306 00
Sumit Mittu
 
Aca2 10 11
Aca2 10 11Aca2 10 11
Aca2 10 11
Sumit Mittu
 
Aca2 09 new
Aca2 09 newAca2 09 new
Aca2 09 new
Sumit Mittu
 
Aca2 08 new
Aca2 08 newAca2 08 new
Aca2 08 new
Sumit Mittu
 
Aca2 07 new
Aca2 07 newAca2 07 new
Aca2 07 new
Sumit Mittu
 
Aca2 06 new
Aca2 06 newAca2 06 new
Aca2 06 new
Sumit Mittu
 
Aca11 bk2 ch9
Aca11 bk2 ch9Aca11 bk2 ch9
Aca11 bk2 ch9
Sumit Mittu
 
Aca2 01 new
Aca2 01 newAca2 01 new
Aca2 01 new
Sumit Mittu
 

More from Sumit Mittu (8)

Int306 00
Int306 00Int306 00
Int306 00
 
Aca2 10 11
Aca2 10 11Aca2 10 11
Aca2 10 11
 
Aca2 09 new
Aca2 09 newAca2 09 new
Aca2 09 new
 
Aca2 08 new
Aca2 08 newAca2 08 new
Aca2 08 new
 
Aca2 07 new
Aca2 07 newAca2 07 new
Aca2 07 new
 
Aca2 06 new
Aca2 06 newAca2 06 new
Aca2 06 new
 
Aca11 bk2 ch9
Aca11 bk2 ch9Aca11 bk2 ch9
Aca11 bk2 ch9
 
Aca2 01 new
Aca2 01 newAca2 01 new
Aca2 01 new
 

Recently uploaded

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 

Int306 03

  • 1. INT306 Database Management Systems OTHER DATA MODELS Text book Database System Concepts A. Silberschatz, H. F. Korth, S. Sudarshan Course Instructor Mr. Sumit Mittu Assistant Professor and Placement Coordinator, CSE/IT Lovely Professional University, Punjab (India) sumit.12735@lpu.co.in sumit.mittu@gmail.com http://tinyurl.com/askSumit 01-03-2014 11:29:39
  • 2. IN THIS CHAPTER • • • • object oriented model network model hierarchical model relational model 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 2
  • 3. OBJECT ORIENTED DATA MODEL • Need for complex data types • Object Oriented Data Model • Object Structure • An object encapsulates set of variables, messages & methods • Object Classes • Inheritance • Class hierarchies and Multiple inheritance • Object Identity • Name, value and built-in • Object Containment 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 3
  • 4. OBJECT ORIENTED DATA MODEL • Object Relational (OR) Model • Implementation in SQL (most basic implementation) • Create an Object Type • CREATE TYPE Engineering AS OBJECT (Name VARCHAR(10), Roll NUMBER(8), Program VARCHAR(10)); • Create a table of objects/types • CREATE TABLE Students OF Engineering; • Now you can fire any queries on Stduents table just like the way do on any other table. E.g. • • • • DESCRIBE Students; INSERT INTO Students Values('Priya', 25,'M.Tech'); INSERT INTO Students(Name, Program) VALUES('Kunal','B.Tech'); SELECT * FROM Students WHERE Roll IS NULL; 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 4
  • 5. NETWORK MODEL • A network database is a collection of records connected to one another through links • A record is equivalent to an entity in the E-R model • A field/attribute in record contains only one data value • A link is an association between precisely two records • Data Structure Diagram • Defined as the schema representing design of network database • Boxes represent record types, lines represent links 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 5
  • 6. NETWORK MODEL type customer = record customer-name: string; customer-street: string; customer-city: string; 01-03-2014 11:29:41 type account = record account-number: integer; balance: integer; Sumit Mittu, Assistant Professor, CSE/IT 6
  • 7. NETWORK MODEL 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 7
  • 8. NETWORK MODEL • (a) One to many relationship • (b) One to one relationship 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 8
  • 9. NETWORK MODEL • One to one 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 9
  • 10. NETWORK MODEL • Many to many 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 10
  • 11. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 11
  • 12. NETWORK MODEL 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 12
  • 13. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 13
  • 14. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 14
  • 15. NETWORK MODEL • Mapping of Networks to Files 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 15
  • 16. NETWORK MODEL • Mapping of Networks to Files – Ring structure 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 16
  • 17. SCRATCH YOUR MIND!!! • 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 17
  • 18. HIERARCHICAL MODEL • A hierarchical database is a collection of records connected to one another through links • The basic concepts are similar to network model but… • Hierarchical Model supports only 1:1 and 1:N relationships • Network Model supports 1:1, 1:N, N:1 as well as M:N relationships 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 18
  • 19. HIERARCHICAL MODEL • Tree Structure Diagram • Defined as the schema representing design of hierarchical database • The single instance of a database tree • The root of this tree is a dummy node • The children of that node are actual instances of the appropriate record type • Boxes represent record types, lines represent links • Record organised as rooted trees called database tree • No cycles in underlying graphs 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 19
  • 20. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 20
  • 21. HIERARCHICAL MODEL 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 21
  • 22. HIERARCHICAL MODEL • M:N relationship 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 22
  • 23. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 23
  • 24. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 24
  • 25. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 25
  • 26. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 26
  • 27. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 27
  • 28. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 28
  • 29. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 29
  • 30. HIERARCHICAL MODEL • Virtual Records • It contains no data value • It contains a logical pointer to a physical record • Helps to overcome drawbacks raised due to replication • Data inconsistency during update operations • Waste of space due 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 30
  • 31. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 31
  • 32. HIERARCHICAL MODEL • Mapping of Hierarchies to Files • Implementation with parent-child pointers 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 32
  • 33. HIERARCHICAL MODEL • Mapping of Hierarchies to Files • Implementation with leftmost-child and next-sibling pointers 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 33
  • 34. HIERARCHICAL MODEL • Mapping of Hierarchies to Files • Implementation with pre-order threads 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 34
  • 35. SCRATCH YOUR MIND!!! • • 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 35
  • 36. RELATIONAL MODEL • Uses a collection of tables to represent both the data and relationships among those data • Relation/Tables • Tuples/Records/rows of a table • Attributes/Fields/columns of a table • Domain of an attribute • Atomic Domain • NULL values • Relation Schema (and Database Schema) • Relation Instance (and Database Instance) 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 36
  • 37. RELATIONAL MODEL • A1, A2, …, An are attributes • R = (A1, A2, …, An) is a relation schema • Example: • instructor = (ID, name, dept_name, salary) • Formally, given sets D1, D2, …. Dn, a relation r is a subset of • D1 x D2 x … x Dn • Thus, a relation is a set of n-tuples (a1, a2, …, an) where each ai  Di • The current values (relation instance) of a relation are specified by a table • An element t of r is a tuple, represented by a row in a table 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 37
  • 38. RELATIONAL MODEL • Relational Database is based on Relational Model • Collection of tables, each of which has a unique name • The order of tuples in a relation (table) is irrelevant • The order of attributes in a relation is irrelevant • Keys: • Super key, candidate key, primary key (entity integrity constraint) • Foreign key (referential integrity constraint) • Referencing relation and Referenced relation • Also includes a DDL and DML • Primarily SQL for data definition and manipulation 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 38
  • 39. RELATIONAL MODEL 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 39
  • 40. RELATIONAL MODEL • Relational Database Design • Database consists of multiple relations that contain information about and enterprise broken up into multiple parts • Instructor, Student, Advisor, etc. • Bad Design • Repetition of information • Missing information (due to null values) • Normalization is required to generate good design • Schema Diagrams 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 40
  • 41. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 41
  • 42. RELATIONAL MODEL • DDL • SQL Commands: • CREATE, ALTER, DROP, RENAME, DESC or DESCRIBE • DML • Procedural • PL/SQL Code blocks • Declarative (Non-procedural) – Query language • SQL Commands: • SELECT, INSERT, UPDATE, DELETE • Embedded SQL: • Application programs, OLEDB/ODBC drivers, DML Pre-compilers, etc. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 42
  • 43. RELATIONAL MODEL • Other Relational Query Languages • Procedural v/s Non-procedural(declarative) • “Pure” Languages • Relational Algebra • Relational Calculus • Tuple Relational Calculus • Domain Relational Calculus 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 43
  • 44. RELATIONAL MODEL • Relational Algebra Operations • • • • Selection Projection Cartesian Product Joins • Natural join, Inner Join, Theta Join, Self Join • Outer Join (Left / Right / Full) • Set Operations • Union, Intersection, Difference • Rename, Division, etc. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 44
  • 45. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 45
  • 46. SCRATCH YOUR MIND!!! • 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 46
  • 47. RELATIONAL MODEL • Tuple Relational Calculus • Non procedural query language • Queries expressed as: • { t | P(t) } • Example queries • { t | t є instructor ^ t[salary] > 5000 } • { t |∃ s є instructor (t[id] = s[id] ^ s[salary] > 8000) } • { t | ¬ (t є instructor) } 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 47
  • 48. RELATIONAL MODEL • Domain Relational Calculus • Non procedural query language • Queries expressed as: • { <x1, x2,..xn> | P(x1, x2,…,xn) } • Example queries • { <i, n, s> | <i, n, s> є instructor ^ s > 5000 } • i, n and s represent the id, name and salary columns of instructor table 01-03-2014 11:29:40 Sumit Mittu, Assistant Professor, CSE/IT 48