Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
INT306
Database Management Systems
OTHER DATA MODELS
Text book

Database System Concepts
A. Silberschatz, H. F. Korth, S. ...
IN THIS CHAPTER
•
•
•
•

object oriented model
network model
hierarchical model
relational model

01-03-2014 11:29:41

Sum...
OBJECT ORIENTED DATA MODEL
• Need for complex data types
• Object Oriented Data Model
• Object Structure
• An object encap...
OBJECT ORIENTED DATA MODEL
• Object Relational (OR) Model
• Implementation in SQL (most basic implementation)
• Create an ...
NETWORK MODEL
• A network database is a collection of records
connected to one another through links
• A record is equival...
NETWORK MODEL
type

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

01-03-2014 1...
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 Pr...
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/...
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...
HIERARCHICAL MODEL
• Tree Structure Diagram
• Defined as the schema representing design of hierarchical
database
• The sin...
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
• He...
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

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

01-03...
HIERARCHICAL MODEL
• Mapping of Hierarchies to Files
• Implementation with pre-order threads

01-03-2014 11:29:41

Sumit M...
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/Ta...
RELATIONAL MODEL
• A1, A2, …, An are attributes
• R = (A1, A2, …, An) is a relation schema
• Example:
• instructor = (ID, ...
RELATIONAL MODEL
• Relational Database is based on Relational Model
• Collection of tables, each of which has a unique nam...
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...
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 b...
RELATIONAL MODEL
• Other Relational Query Languages
• Procedural v/s Non-procedural(declarative)
• “Pure” Languages
• Rela...
RELATIONAL MODEL
• Relational Algebra Operations
•
•
•
•

Selection
Projection
Cartesian Product
Joins
• Natural join, Inn...
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) }

• Exa...
RELATIONAL MODEL
• Domain Relational Calculus
• Non procedural query language
• Queries expressed as:
• { <x1, x2,..xn> | ...
Upcoming SlideShare
Loading in …5
×

Int306 03

978 views

Published on

Data Models, Object Oriented, Object Relational, Relational, Network Model, Hierarchical Model, Relational Query languages, relational Algebra, Tuple Calculus, Domain Calculus

Published in: Education
  • Be the first to comment

Int306 03

  1. 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. 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. 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. 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. 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. 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. 7. NETWORK MODEL 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 7
  8. 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. 9. NETWORK MODEL • One to one 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 9
  10. 10. NETWORK MODEL • Many to many 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 10
  11. 11. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 11
  12. 12. NETWORK MODEL 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 12
  13. 13. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 13
  14. 14. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 14
  15. 15. NETWORK MODEL • Mapping of Networks to Files 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 15
  16. 16. NETWORK MODEL • Mapping of Networks to Files – Ring structure 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 16
  17. 17. SCRATCH YOUR MIND!!! • 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 17
  18. 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. 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. 20. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 20
  21. 21. HIERARCHICAL MODEL 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 21
  22. 22. HIERARCHICAL MODEL • M:N relationship 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 22
  23. 23. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 23
  24. 24. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 24
  25. 25. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 25
  26. 26. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 26
  27. 27. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 27
  28. 28. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 28
  29. 29. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 29
  30. 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. 31. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 31
  32. 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. 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. 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. 35. SCRATCH YOUR MIND!!! • • 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 35
  36. 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. 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. 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. 39. RELATIONAL MODEL 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 39
  40. 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. 41. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 41
  42. 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. 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. 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. 45. 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 45
  46. 46. SCRATCH YOUR MIND!!! • 01-03-2014 11:29:41 Sumit Mittu, Assistant Professor, CSE/IT 46
  47. 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. 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

×