0% found this document useful (0 votes)
4 views31 pages

Unit-3 Concept of Database

The document provides an overview of database concepts, including definitions of data, databases, and information, as well as characteristics and types of database architectures. It discusses data independence, levels of data abstraction, components of a database system, and various database models such as hierarchical, network, and relational. Additionally, it highlights the roles of different database users and the advantages and disadvantages of 1-tier, 2-tier, and 3-tier architectures.

Uploaded by

khushiptl1566
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)
4 views31 pages

Unit-3 Concept of Database

The document provides an overview of database concepts, including definitions of data, databases, and information, as well as characteristics and types of database architectures. It discusses data independence, levels of data abstraction, components of a database system, and various database models such as hierarchical, network, and relational. Additionally, it highlights the roles of different database users and the advantages and disadvantages of 1-tier, 2-tier, and 3-tier architectures.

Uploaded by

khushiptl1566
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/ 31

Subject :DATA PROCESSING AND ANALYSIS(105)

UNIT-3 Concepts of Database


Introduction to Data
Data: Facts that can be recorded like text, numbers, video,
speech, images, audio
Database : Collection of related data that represent some
real world entities.
Information : Meaningful/processed data
What is Database?
 A Database is a collection of information that is
organized so that it can be easily accessed, managed
and updated. It one view, databases can be classified
according to types of content.
Example: Consider the Facebook. It needs to store,
manipulate and present data related to user, their friends,
activities, messages, advertisements and lot more.
3.1 Database Characteristics
 It uses a digital repository established on a server to
store and manage the information.
 It can provide a clear and logical view of the process that
manipulates data.
 DBMS contains automatic backup and recovery
procedures.
 It contains ACID(Atomicity consistency isolation
durability) properties which maintain data in healthy
state in case of failure.
 It can reduce the complex relationship between data.
 It is used to support manipulation and processing of
data.
 It is used to provide security of data.
1 Prepared By : Krishna Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
 It can view the database from different viewpoints
according to the requirement of the user.
3.1.1 Data Independence (Logical and Physical)
 Data independence is to change the database schema at
one of the database system without requiring to change
the schema at the next higher level.
 Data independence helps you to keep data separated
from all programs that make use of it.
There are two types of data independency:
1.Physical Data Independence
2.Logical Data Independence
There are mainly 3 levels of data abstraction:
1.physical level
2.logical level
3.View level

1. Physical level:
 Physical level is the lowest level of data abstraction.
2 Prepared By : Krishna Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
 It tell us how the data is stored in memory.
 The access methods like sequential or random access
are used to access data.
 It is also known as internal level/ Internal schema.
 The internal schema defines the physical storage
structure of the database.

2. Logical level
 Logical level contains the information that is actually
stored in the database in the form of tables.
 It is also known as conceptual schema.
 It defines all database entities, their attributes, and
their relationships.
 The programmers generally work at this level because
they are aware of such things about database systems.

3.View level
 View level is the Highest level of abstraction. Only a
part of the actual database is viewed by the users.
 It hides the unrelated details of the database from
the user.
 It also known as External level schema.
 This level exists to ease the accessibility of the database
by an individual user.
 Multiple views of the same database may exist.
 Users can just view the data and interact with the
database, storage and implementation details are
hidden from them.

 The main purpose of the data abstraction is achieving


data independence in order to save time and cost
required when the database is modified or altered.
3 Prepared By : Krishna Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
 We have namely two levels of data independence arising
from these levels of abstraction.
3.1.2 Components of database (User, Application, DBMS,
Database)
A database system is partitioned into modules that deal with each
of the responsibilities of the overall system.

Database Users:
Database users are the one who really use and take the
benefits of database.
4 Prepared By : Krishna Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
These will be different types of users depending on their need
and way of accessing the database.
DBMS Architecture divided into four parts:
1)DBMS Users
2)Query Processor
3)Storage Processor
4)Disk Storage

Different database users are as follows:


1)DBMS Users
Database users are categorized based on their interaction
with the database.
a) Native/End Users
 End users are the unsophisticated who don’t have any
DBMS Knowledge but they frequently use the database
applications in their daily life to get the desired results.
Example :
 Railway ticket booking users are native users.
 Clerks in any bank is a native user because they do not
have any DBMS knowledge but they still use the
database and perform their given tasks.

b) Application Programmer
 Application program are the back end programmer who
writes the code for the application program.
 They are the computer professionals,

5 Prepared By : Krishna Mistry


Subject :DATA PROCESSING AND ANALYSIS(105)
 These program could be written in programming
Languages such as .net, C, C++, Java etc.
c) Sophistical Users
 Sophistical Users can be engineers, Scientist , Business
analyst, Who are familiar with the database.
 They can develop their own database application
according to their requirement.
 They don’t write the program code but they interact the
database by writing SQL Queries directly through the
query processor.
d) Database Administrator(DBA)
 DBA is a person /team who defines the schema and also
controls the 3 levels of database.
 The DBA will create a new account id and password for
the user if he/she need to access the database.
 DBA is also responsible for providing security to the
database and he allows only the authorized users to
access/modify the database.
 DBA monitors the recovery and backup and provide
technical support.
 The DBA Has a DBA account in the DBMS which called
a system or super user account.
 DBA repairs damage caused due to hardware and/or
software failures.

2)Query Processor
 In interprets the requests(Queries) received from end
user via an application program into instructions.
 It also executes the user request which is received from
the DML Compiler.
6 Prepared By : Krishna Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Query Processor Container the following Components:
a) DDL Compiler
 The DDL Compiler, which converts these
statements to a set of tables.
 These tables contains the metadata concerning the
database and are in the form that can be used by
other components of the DBMS.

b) DML Pre-compiler and Query Processor


 The DML pre-compiler converts the DML
statements embedded in an application program to
normal procedure calls in the host language.
The Query Processor Components include:
i) DDL interpreter
It processes the DDL statements into a set of table
containing metadata( data about data)
ii) DML Compiler
It processes the DML statements into low level
instruction (Machine Language) , so that they can be
executed.
iii) Query Evaluation Engine
Which executes generated by the DML Compiler.

3) Storage Manager/Processor
 Storage manager is a program that provides an interface
between the data stored in the database and the queries
received.
 It is also known as database control system.

7 Prepared By : Krishna Mistry


Subject :DATA PROCESSING AND ANALYSIS(105)
 It maintains the consistency and integrity of the
database by applying the constraints and executes the
DCL statements.
 It is responsible for Updating, Storing, Deleting and
Retrieving data in the database.
It Contains the following Components:
a) Authorized manager
It tests for the satisfaction integrity Constraints and
checks the authority of users to access data.
b) Transaction Manager
Which ensures that the database remains in a
consistent(correct) state despite system failure, and that
concurrent transaction execution proceed without
conflicting.
c) File Manger
Which manages the allocation of space on disk storage
and the data structures used to represent information
stored on disk.
d) Buffer Manager
It is responsible for buffer data.
4) Disk storage:
It contains the following Components:
a) Data files
It stores the data.
b) Data Dictionary
It contains the information about the structure of any
database object.
It is the repository of information that governs the
metadata.
c) Indices

8 Prepared By : Krishna Mistry


Subject :DATA PROCESSING AND ANALYSIS(105)
It provides fast access to data items that hold particular
values.
3.1.3 Database Architecture (1 tier, 2-tier, 3-tier)
 The DBMS design depends upon its architecture
 The basic client/server architecture is used to deal with
a large number of PCs, web servers, database servers
and other components that are connected with
networks.
 DBMS architecture depends upon how users are
connected to the database to get their request done.
Types of database Architecture

 Database architecture can be seen as a single tier or


multitier but logically. Database architecture is of two
types like 2- tier architecture and 3-tier architecture.

1-tier Architecture
 In this architecture the database is directly available to
the user. it means the user can directly sit on the DBMS
and uses it.
 Any changes done here will directly be done on the
database itself. It doesn’t provide a handy tool for end
users.
9 Prepared By : Krishna Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
 The 1-tier architecture is used for development of the
local application, where programmers can directly
communicate with the database for the quick response.
Example:
MS Office comes in one tier architecture.

Advantages
1. Easy to implement and optimize performance.
2. Do not have compatibility or Context switching issues.
3. The cost of development is less. E.g. - development and
management cost.
4. Fast for a single user because communication with
another system is not necessary.
Disadvantages
1. Do not support remote/distributed access for data
resources.
2. The cost of the central mainframe is high.
3. Completely unscalable. Only one user can access the
system at a given time via the local client.

2-tier DBMS Architecture


10 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
 The 2 tier architecture is same as basic client-server. In
the two tier architecture, applications on the client end
can directly communicate with the database.
 At the server side. For this interaction, API’s like ODBC,
JDBC are used.
 The user interfaces and application programs are run on
the client side.
 The server side is responsible to provide the
functionality:: Query Processing and transaction
processing.

 Such an architecture provides the DBMS extra security


as it is not exposed to the End User directly.
 Also, security can be improved by adding security and
authentication checks in the Application layer too.
Examples of 2-tier architecture are desktop applications,
excel sheets, word document, and desktop games.
Advantages
1. It is easy to maintain.
2. The modification is very easy.
3. Communication is very fast.

11 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Disadvantages
1. It is unscalable when number of users are increase.
2. Less secure because clients are directly interacting with
Database.

3-tier DBMS Architecture


 The 3 tier architecture contains another layer between
the
Client and server.
In this architecture, client can’t directly communicate
with the server.
The application on the client-end interacts with an
application server with interacts with an application
server with further communicates with the database
system.
The 3-tier architecture is used in case of large web
application.

Advantages
1. High performance, lightweight
2. Scalability.
3. Improve Data Integrity
12 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
4. Improved Security
5. Easy to maintain and modification is bit easy, won’t affect
other modules
Disadvantages
1. Increase Complexity/ Effort(maintenance)

3.1.3.1 Comparison, Advantages and Disadvantages.

Two-Tier Database Three-Tier Database


S.NO Architecture Architecture

It is a Client-Server
1 It is a Web-based application.
Architecture.

In two-tier, the application


In three-tier, the application
logic is either buried inside
logic or process resides in the
the user interface on the
2 middle-tier, it is separated
client or within the
from the data and the user
database on the server (or
interface.
both).

Two-tier architecture Three-tier architecture


consists of two layers : consists of three layers :
3
Client Tier and Database Client Layer, Business Layer
(Data Tier). and Data Layer.

It is easy to build and It is complex to build and


4
maintain. maintain.

Two-tier architecture runs Three-tier architecture runs


5
slower. faster.

13 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)

It is less secured as client It is secured as client is not


6 can communicate with allowed to communicate with
database directly. database directly.

It results in performance loss


It results in performance whenever the system is run
7 loss whenever the users on Internet but gives more
increase rapidly. performance than two-tier
architecture.

Example – Contact Example – Designing


Management System registration form which
8 created using MS-Access or contains text box, label,
Railway Reservation button or a large website on
System, etc. the Internet, etc.

3.2 Database Models(Hierarchical , Network, E/R,


Relational)
Database Model
 A set of Rules and standards that defines how the
database organizes/store data is called database model.
 It also defines users views the organization of data.

Hierarchical Model
 The Hierarchical model arranges records in hierarchy
like an organizational chart.
 Each record type in this model is called a node or
segment.

14 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
 A node represents a particular entity.
 The top-most node is called root. Each node is a
subordinate of the node that is at the next higher level.
Example: we can represents the shopping websites in the
following way:

 A higher level node is called parent and lower level node


is called child. A parent node can have one or many
child nodes.
 A child node can have only one parent node.
 This kind of structure is often called inverted tree
Drawback
 It is difficult to modify.
 It cannot represent all the relation between data
 It is a restricted model.
Network Model
 The network model is similar to hierarchical model.
 The difference is that child node can have more than one
parent nodes.
 The Child nodes are represented by arrows in network
model.
 It also provides more flexibility than hierarchical model.

15 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)

Drawback
 It is slow complex and more difficult to maintain.
 It requires more complex diagram to represent a database

Relational Model
 Relational model is the most commonly used database
model.
 It is more flexible than hierarchical and network database
models.
 The relational model consists of simple relations.
 A relation is a term used for table.
 A relation represents a particular entity. It is used to store
information about the entity.
 The relationships are based on the data of the entities.
16 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
 Dr E.F Codd Introduced the relational model.
The relationship between entities is represented by the
following diagram :

3.2.1 E/R Model : Entity, Relationship, Attribute


 The entity- relationship(E-R) model is a high level data
model.
 It is based on a perception of a real world that consists
of a collections of basic objects called entities and of
relationships among these objects.
 It develops a conceptual design for the database. It also
develops a very simple and easy to design view of data.
For Example : Suppose we design a school database. In this
database, the student will be an entity with attribute like
address, name id age etc.

17 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Components of ER Diagram

1.Entity
 It is a thing or object in the real world that is
distiguishable from all other object.
 Anything about which we store information is called on
entity.
Entity Set :
 It is a set of entities of the some type that share the
some properties or attributes.
 An entity set can be represented as rectangles.

3.2.3 Strong Entity and Weak Entity


Entity Set
There two types of Entity set
18 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
1.Weak Entity set :
 An entity that depends on another entity called a weak
entity set.
 The weak entity set doesn’t contain ay key attribute of
its own.
 Weak Entity set is represented by a double rectangle.

Weak Entity
2.Strong Entity Set:
 A strong entity set is an entity set that contains
sufficient attributes to uniquely identify all its entities.
 Primary key Exists for a strong Entity set.
 Single rectangle is used to representing a strong Entity
set.

Strong entity
Strong Entity VS Weak Entity:

Sr
No. Strong Entity Weak Entity

Strong entity always has While a weak entity has a partial


1.
a primary key. discriminator key.

19 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Sr
No. Strong Entity Weak Entity

Strong entity is not


Weak entity depends on strong
2. dependent on any other
entity.
entity.

Strong entity is
Weak entity is represented by a
3. represented by a single
double rectangle.
rectangle.

Two strong entity’s While the relation between one


relationship is strong and one weak entity is
4.
represented by a single represented by a double
diamond. diamond.

Strong entities have


While weak entity always has
5. either total participation
total participation.
or not.

Example of strong entity VS Weak entity

3.2.2 E/R Diagram: One to One, one to many, many to


one, many to many
20 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Relationship Constraints
 A relationship is used to describe the relation between
entities.
 Diamond or rectangular box is used to represent the
relationship.
 Mapping cardinalities ,or cardinality ratios, express the
no of entities to which another entity can be associated
via a relationship set.

There are four types of mapping constrains or


relationship.
1) One to one Relationship
 When only one instance of an entity is associated with
the relationship, then it is known as one to one
relationship.
Example: A female can many to one male and a male can
marry to one Female

Using Sets, it can be represented as:

21 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)

2) One to Many Relationship


 When only one instance of the entity on the Left and
more than one instance of an entity on the Night
Associates with the relationship then this is known as
a one to Many Relationship.

3) Many to One Relationship


 When more than one instance of the entity on the left
and only one instance of an entity on the right
associates with the relationship is known as Many to
One Relation.

Example: Student enrolls for only one course but a


course can have Many Students.

22 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)

Using Sets, it can be represented as:

4) Many to Many Relationship


 When More than one instance of the entity on the left
and more than one instance of an entity on the right
associates with the relationship then it is known as
many to many relationship.
Example: Employee can assign by many projects and
project can have many employee.

23 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Using Sets, it can be represented as:

3.2.4 Key Attribute, Derived Attribute, Multi- valued


Attribute
 The attribute is used to describe the property of an
entity.
 An entity set may contain any number of attribute.
 Attributes are represented in an elliptical shape.
Example : Id, age, address, name etc can be attribute of a
student.

Types of Attributes
24 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
i. Simple Attribute
 An attribute that can not be further subdivided into
components is a simple attribute.
 It is represented by Ellipse
Example : The Roll_no of a student.

ii. Composite Attribute


 An attribute that can be split into components is a
composite attribute.
 The composite attribute is represented by an ellipse
and those ellipse are connected with an ellipse.

iii. Key Attribute


 The key attribute is used to represent the main
characteristics of an entity.
 It represent a primary key.
 The key attribute is represented by an ellipse with the
next underlined.

25 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)

iv. Multivalued Attribute


 An Attribute can have more than one value. These
attribute are known as a multivalued attribute.
 The double Ellipse is used to represent multivalued
attribute.
Example: A student can have more than one Phone No.

v. Derived Attribute
 An attribute that can be from other attribute is known
as derived attribute.
 It can be represented by a dashed Ellipse.
Example : A person’s age changes over time and can be
derived from another attribute like date of birth.

Symbols used for Entity Relationship Diagram:


Strong A strong entity has a
Entity primary key.
Weak entities are
dependent on strong
entity.

26 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Weak Entity The weak entity do
not have a primary
key and are
dependent on the
parent entity.
Relationship Any association
between two entity
types.

Attributes An attribute describes


the property of an
entity.

Multivalued A Multivalued
Attribute attribute can have
more than one value
that is represented by
double ellipse.
Derived A derived attribute is
Attribute based on another
attribute that is
represented by doted
ellipse.
Key A key attribute can
Attribute uniquely identify an
entity from an entity
set.

27 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Composite A composite attribute
Attribute as an address is
composed of other
attribute such as pin
code, state, country.

Lines
Relationship Association between
one strong and a
weak entity set shown
by using the double
diamond symbol.

3.2 Types of Keys:


Keys
 A key is a value which can always be used to uniquely
identify an object instance.
 Key is used to uniquely identify any record or row of
data from the table.
 It is also used to establish and identify relationship
between tables.
 Example: Id is used as a key in the student table
because it is unique for each student.
 In the person table, passport number, License number
are keys since they are unique for each person.

Types Of Keys
3.3.1 Super key, candidate key, Primary key, Composite
key, Foreign key, Unique key.

28 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)

i. Super Key
 A Super Key is a set of one or more attribute that taken
collectively, allow us to identify uniquely an entity in the
Entity Set.
Example : In student table with attribute( S_Rollno,
S_Name, S_Branch, S_Year)
Super key S1->S_Rollno, S_Name
S2->S_Rollno, S_Branch
S3->S_Rollno,S_Year
S4->S_Rollno,S_Name, S_Branch
S5->S_Rollno, S_Branch, S_Year
ii. Candidate Key
 The minimal set of attributes that can uniquely identify
a table is known as a candidate key.
 Candidate key can be define as the minimum no of
super key that identifies the record uniquely.
 It must contain unique values.
 Every table must have at least a single candidate key.

29 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
Example : In student table with attribute(S_Rollno,
S_Name, S_Branch, S_Year)
Candidate key : C1-> S_Rollno
C2-> S_Rollno, S_name
iii. Primary Key
 Primary key can be define as the minimum no of
candidate key that is chosen by the database designer
as the principal means of identifying entities within an
entity set.
 It is unique key.
 It can identify only one tuple(a record) at a time .
 It has no duplicate values. It has unique values.
 It can not be NULL.
 Primary Keys are not necessarily to be a single
column more than one the column can also be a
primary key for a table.
Example: In student table with attribute(S_Rollno,
S_Name, S_Branch, S_Year)
Primary Key : P1-> S_Rollno
iv. Composite Key
 Whenever a primary key consists of more than one
attribute it is known as a composite key.
Example : In student Table with a attribute(S_Rollno,
S_Name, S_Branch, S_Year)
Composite key : S_Rollno, S_id
v. Foreign Key
 A foreign key is a column whose value are the same as
the primary key of another table.
 It combines two or mote relations(table) at a time.
 They act as a cross reference between the tables.
30 Prepared By : Krishna
Mistry
Subject :DATA PROCESSING AND ANALYSIS(105)
 Foreign key are the column of the table used to point to
the primary key of another table.

vi. Unique Key


 Unique keys can consist of multiple columns.
 Unique keys are also called alternate keys.
 Unique keys are an alternative to the primary key of the
relation.

31 Prepared By : Krishna
Mistry

You might also like