0% found this document useful (0 votes)
22 views

Database PDF

Database jdjsjs s.shshais s.sbshaia d.djsusis d djsisis ddjsis shxnd snshana a banana banana and a

Uploaded by

upxwbn
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Database PDF

Database jdjsjs s.shshais s.sbshaia d.djsusis d djsisis ddjsis shxnd snshana a banana banana and a

Uploaded by

upxwbn
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Introduction to Database System

Ghalib University
Computer Science Department
Zabihullah Rahmani

1 Ghalib University By Zabihullah Rahmani


Table of contents
 Data Models

 Different Types of Data Models

2 Ghalib University By Zabihullah Rahmani


Data Models
 A Data model is a collection of concepts that can be used to describe the

structure of the database, which includes entity, relationship and data


constraint.

 A data model always hides the details of the data storage and

implementation from the user.

3 Ghalib University By Zabihullah Rahmani


Schemas, Instances, and Database State
 In a data model, it is important to distinguish between the description of

the database and the database itself.

 The description of a database is called the database schema, which is

specified during database design and is not expected to change frequently.

4 Ghalib University By Zabihullah Rahmani


Schemas, Instances, and Database State
 Most data models have certain conventions for displaying schemas as

diagrams.

 A displayed schema is called a schema diagram.

5 Ghalib University By Zabihullah Rahmani


Schemas, Instances, and Database State
 The actual data in a database may change quite frequently.

 The data in the database at a particular moment in time is called a

database state or snapshot. It is also called the current set of occurrences


or instances in the database.
 For example, the database shown in Figure 1.2 changes every time we add a new student

or enter a new grade.

6 Ghalib University By Zabihullah Rahmani


Cont…

7 Ghalib University By Zabihullah Rahmani


DATA MODEL BASIC BUILDING BLOCKS
 The basic building blocks of all data models are entities, attributes, relationships,

and constraints.

 An entity is anything (a person, a place, a thing, or an event) about which data

are to be collected and stored.

 An attribute is a characteristic of an entity. For example, a CUSTOMER entity

would be described by attributes such as customer last name, customer first


name, customer phone, customer address.

 A relationship describes an association among entities.


 Data models use three types of relationships: one-to-many, many-to-many, and
one-to-one.
 A constraint is a restriction placed on the data.
8 Ghalib University By Zabihullah Rahmani
Different Types of Data Models
 There are many types of data model. Some important data models are:

 Hierarchical Data Model

 Network Data Model

 Relational Data Model

 Object-Relational Data Model

 These data models are mostly called database model.

 A database model is a theory describing how a database is structured and

used.

9 Ghalib University By Zabihullah Rahmani


Hierarchal Data Model
 This model was developed the early 1960 by Rochwell and Caterphillar

in IBM. IBM IMS(information Management system) is the fist


software based on hierarchal data model.

 The hierarchical data model organizes data in a tree structure.

 There is a hierarchy of parent and child data segments.

 The first node of the tree is called “Root Segment”.

 A node is a collection of data items describing the entity.

 This model provides efficient data structure when there is 1:M

relationship.
10 Ghalib University By Zabihullah Rahmani
Example
 In the following diagram, Author is the root node. The root node has 4 children.

 The root record is always on level 0 and is the first element to be traversed in
the data model.
11 Ghalib University By Zabihullah Rahmani
Example
 Let's look at the following 3 database tables - Person, Authors, and Books.

<>Person Table
<>ID Role Description ParentID
1 Author Writes, speaks, trains 0

Authors Table
ID Name Description ParentID
101 Allen O'Neill Author writes on AI 1
102 Mahesh Chand Author writes on C# 1
103 David McCarter Author writes on .NET 1
104 Raj Kumar Author writes on AWS 1

Books Table
ID Topic Title ParentID
1001 ADO.NET ADO.NET Programming 102
1002 GDI+ Programming GDI+ 102
1003 C# Learn C# 8.0 102
1004

12 Ghalib University By Zabihullah Rahmani


Cont..
 The following tree diagram represents above tabular data into a
hierarchical form with their parent and level.

13 Ghalib University By Zabihullah Rahmani


Cont..
 Advantages

 The structure of a hierarchical is easy to understand. The hierarchy is based

on logical relationships between parent and child segment types.


 They provide very efficient high speed retrieval.

 Disadvantages

 This data model doesn't support the M:N relationship directly.

 It is difficult to use them to represent non-hierarchical relationships.

14 Ghalib University By Zabihullah Rahmani


Network Data Model
 This model is an extension of the hierarchical model. It was the most popular

model before the relational model.

 In 1971, the Conference on Data System Languages (CODASYL) formally

defined the network model.

 This model organizes data using two fundamental constructs, called records

type(entity) and sets type(relationship). Records type contain fields, and sets
type define one-to-many relationships between records type: one owner, many
members.

15 Ghalib University By Zabihullah Rahmani


Example 1

16 Ghalib University By Zabihullah Rahmani


Example 2

17 Ghalib University By Zabihullah Rahmani


Cont..
 Some of the popular network databases are:
 Integrated Data Store (IDS)
 IDMS (Integrated Database Management System)
 Raima Database Manager
 TurboIMAGE

18 Ghalib University By Zabihullah Rahmani


The relational data model
 The relational data model was first introduced in 1970 by E. F. Codd.

 The relational model is based on mathematical theory and therefore has a

solid theoretical foundation. However, we need only a few simple concepts to


describe the relational model.

 The relational data model consists of the following three components:

 1. Data structure Data are organized in the form of tables, with rows and

columns.
 2. Data manipulation Powerful operations (using the SQL language) are
used to manipulate data stored in the relations.
 3. Data integrity The model includes mechanisms to specify business rules
that maintain the integrity of data when they are manipulated.
19 Ghalib University By Zabihullah Rahmani
Cont..

20 Ghalib University By Zabihullah Rahmani


Terminology of RDM
 Relation: A table with columns & rows.

 Attributes: An attribute is a named column of a relation.

 Domains: A domains is the set of allowable values for one or more attributes.

 Tuple: A tuple is a row of relation or one row of table is…

 Degree: The degree of a relation is the number of attributes it contains. Or the

number of columns is called…

21 Ghalib University By Zabihullah Rahmani


Properties of Relation
 1. Each relation (or table) in a database has a unique name.

 2. An entry at the intersection of each row and column is atomic (or single

valued).

 3. Each row is unique; no two rows in a relation can be identical.

 4. Each attribute (or column) within a table has a unique name.

 5.The order of the attributes is not important.


 6. The order of tuples is not important.

22 Ghalib University By Zabihullah Rahmani


Object-Relational Model
 It is Similar to a relational database model, but objects, classes and
inheritance are directly supported in database schemas and in the query
language.

 Example: Oracle 11g

23 Ghalib University By Zabihullah Rahmani


Any question…?????

24 Ghalib University By Zabihullah Rahmani

You might also like