DBMS Unit1 Final
DBMS Unit1 Final
Overview:
->Data: These are the characteristics usually numerical data that are observed
through observations.
->Data is any known facts or any smallest information that can be recorded and
have implicit meaning.
->Any fact and figure about an entity that can be recorded is called data.
Data is a raw and unorganized fact that is required to be processed to make it
meaningful.
e.g. Deepak , Btech , audio , number , map , etc.
It refers to raw
Information are facts
facts which one
regarding something
gathers about
Meaning put into context
something and
which are refined
are bare and
through processing
random.
They are text,
numbers,
Nature It is refined data
symbols and
more
Records plus
Based On It is based on analysis
observations
We measure
We measure data information in units
Measurement
in bits and bytes of time, quantity and
more
DBMS: It is a set of software programs that allows users to create, edit and update
data in database files , and store and retrieve data from those database files.
e.g. oracle, MySQL, MSSQL Server, SQL ,DB2(IBM)
DBMS application
1. Banking –to store the exchange data of the client ,transaction details , etc.
2. Railway Reservation System – to store the record or information of ticket
appointments, status about train’s appearance, and flight.
3. Airlines-to store the records of flight takeoff, appearance, and defer status.
4. Universities/ education sector
5. Online shopping
6. Human Resource Management-They store data about worker’s
compensation, assessment, and work.
7. Manufacturing- To keep the data about their items like bills, acquisition of
the item, amount, inventory.
8. Social media sites-to store data of users
9. Library Management System –to store all the data identified with the name
of the book, issue date, accessibility of the book, and its writer.
10.Credit card exchanges –The database Management framework is utilized for
buying on charge cards and age of month to month proclamations.
Advantages of DBMS
Views of data
->Views of data refer to the different ways to show the database management
system to the user hiding its complexity.
->Views of data refers to how data is stored in database, what data is stored and
what will be the structure of data.
So, there are 2 views of data :- 1. Data abstraction 2.Schemas and
instances
->The database is highly complex data. Developers hide the complexity of data
structure which might not be familiar with the end-users. So, they provide
abstract views of data. This is called data abstraction. There are 3 levels of
abstraction. They are:
1. Physical level:
( also k/a internal level)
->The physical level describes how
the data is stored in the hardware.
->It also describes how the data can
be accessed.
->The physical level shows the data
abstraction at the lowest level and it
has complex data structures.
-> Only the data administrators
operate at this level.
2. Logical (conceptual) level: it is a level above the physical level, here the data
is stored in the form of entity set, entities, their data types, the relationship
among the entity sets.
->This level of abstraction describes what data are stored in the database
and what relationship exists among those data.
3. View level: it is the highest level of data abstraction and exhibit only a part
of the whole database. It exhibits the data in which the user is interested.
->The view level can describe many views of the same data.
-> Here we user retrieve the info using different application from the
database.
Database Administration
->Data models define how data is connected to each other and how they are
processed and stored inside the system.
->Data model is a collection of concepts that can be used to describe the
structure of the database including data types, relationships and the constraints
applied on data.
->It ensure the nature of data independent of its physical
representation(byte,word,etc)
->The data model supports the communication between the users and database
designers.
Characterstics of a data model
1.bottom up approach must be followed.
2. diagrammatic representation
3.application independent
4.data representation must not be duplicate.
5.consistency and standard validation must be maintained.
->There are two types of data models:-
1. Entity relationship model: Entity-Relationship (ER) Model is based
on the notion of real-world entities and relationships among them.
3. Data Control Language (DCL) : DCL is used to access the stored data. It is
mainly used for revoke and grant the user access to a database.
The DCL commands are: Grant(used to give access to the users or other
rights or opportunities to the database) , Revoke(used to remove granted
permission).
Instance
Collection of information stored in database at a particular moment is called
instance.
Mapping
The mapping of data among the level of database. There are 2 types of
mapping:
1. Conceptual or external mapping: data is transferred from conceptual level
to external level or vise-versa.
2. Internal or conceptual mapping : data is transferred from internal level to
conceptual level or vise-versa.
DBMS Architecture
o 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.
o The client/server architecture consists of many PCs and a workstation
which are connected via the network.
o DBMS architecture depends upon how users are connected to the
database to get their request done.
o Generally the client process requires some resources which are provided
by server to the client.
o The three components of a client-server model are:
o Presentation logic: responsible for formatting or presenting data on
user screen.
o Storage logic: responsible for data storage
o Processing logic: it handles data processing logic, business rule logic
and data management logic.
o Disadvantage
1. Traffic congestion or network is an issue.
2. If a critical server fails then the client’s request cannot be
fulfilled.
o Advantage
1. Provide security
2. User friendly
interface
3. Server guarantee to
those clients who have
permission may access and
change the data.
Types:
logically, database architecture is of two types like: 2-tier architecture and 3-tier
architecture.
1-Tier Architecture
o In this architecture, the database is directly available to the user. It means the user
can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It doesn't
provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local application, where
programmers can directly communicate with the database for the quick response.
2-Tier Architecture
o 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 (open
database connectivity), JDBC(are used.
o The user interfaces and application programs are run on the client-side.
o The server side is responsible to provide the functionalities like: query
processing and transaction management.
o To communicate with the DBMS, client-side application establishes a
connection with the server side.
Advantage
1. Modification is easy
2. Communication is fast
Disadvantage
1. Performance degrades when
number of users increses.
3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and server.
In this architecture, client can't directly communicate with the server.
o The application on the client-end interacts with an application server which
further communicates with the database system.
o End user has no idea about the existence of the database beyond the
application server. The database also has no idea about any other user
beyond the application.
o The 3-Tier architecture is used in case of large web application.
o Many clients can be responded at an instant.
Advantage
1.Data security is guaranteed and
scalability (more no. of clients can
be handled)
2.allows complex processing to
take place at server side.
Disadvantage
1.create an increased need of
network traffic management, fault
tolerance.
2.performance loss if distributed
widely over internet.
Entity- Relationship Model (ER model)
->it defines the conceptual or logical view of database. It is used for designing
database.
->it works around real world entities and the relationship among them.
Entity is a real world object distinguishable from other object based on the
values of the attributes it processes. It is represented as rectangles. Entities
become table in relational model. entities has attributes that give them their
identity.
Entity set = Collection of same type of entities that share the same properties or
attributes. In an ER diagram.
Attribute : These are the units which describes the
properties and characteristics of the entities. These
are descriptive properties by each member of
entity setup. For each attribute, there is a set of
permitted values called the domain. Attributes are
represented by a connected oval (or eclipse) to concerned entity set.
Types of attributes
-2>Composite Attribute –
An attribute composed of many other attribute is called as composite
attribute. For example, Address attribute of student Entity type consists of
Street, City, State, and Country. In ER diagram, composite attribute is
represented by an oval comprising of ovals.
-4>simple attribute-
It consists of atomic values that can’t be further divided. E.g. student’s phone
number
-5>Stored attribute –are physically stored in a database.
Eg DOB (1/1/2000)
-7>descriptive attribute :
Attribute of relationship is called descriptive attribute. the attribute which
describes the relations.an attribute takes a null values when the entity does not
have values for it.
The complete entity type Student with its attributes can be represented as:
1. Unary Relationship –
When there is only ONE entity set participating in a relation, the
relationship is called a unary relationship. For example, one person is
married to only one person.
2. Binary Relationship –
When there are TWO entities set participating in a relationship, the
relationship is called a binary relationship. For example, a Student is
enrolled in a Course.
3. Ternary Relationship –
When there are Three entities set participating in a relationship, the
relationship is called a Ternary relationship.
4. n-ary Relationship –
When there are n entities set participating in a relation, the relationship is
called an an n-ary relationship.
1. One-to-one – When each entity in each entity set can take part only once in
the relationship, the cardinality is one-to-one.
Let us assume that a male can marry one female and a female can marry one
male. So the relationship will be one-to-one.
the total number of tables that can be used in this is 2.
2. Many to one – When entities in one entity set can take part only once in
the relationship set and entities in other entity sets can take part more than
once in the relationship set, cardinality is many to one.
Let us assume that a student can take only one course but one course can be
taken by many students. So the cardinality will be n to 1. It means that for one
course there can be n students but for one student, there will be only one
course.
The total number of tables that can be used in this is 3.
3. Many to many – When entities in all entity sets can take part more than
once in the relationship cardinality is many to many. Let us assume that a
student can take more than one course and one course can be taken by many
students. So the relationship will be many to many.
the total number of tables that can be used in this is 3.
Participation Constraint:
Participation Constraint is applied to the entity participating in the relationship
set.
1. Total Participation – Each entity in the entity set must participate in the
relationship. Total participation is shown by a double line in the ER diagram.
If each student must enroll in a course, the participation of students will be
total.
2. Partial Participation – The entity in the entity set may or may NOT
participate in the relationship.
partial participation is shown by a single line in the ER diagram.
If some courses are not enrolled by any of the students, the participation of
the course will be partial.
The diagram depicts the ‘Enrolled in’ relationship set with Student Entity set
having total participation and Course Entity set having partial participation.
Mapping constraints
o A mapping constraint is a data constraint that expresses the number of
entities to which another entity can be related via a relationship set.
o Mapping cardinality(cardinality ratio) : defines the relationship between
numbers of entities in one entity set with the number of entities to other
entity sets.
o It is most useful in describing the relationship sets that involve more than
two entity sets.
o For binary relationship set R on an entity set A and B, there are four possible
mapping cardinalities. These are as follows:
1. One to one (1:1)
2. One to many (1:M)
3. Many to one (M:1)
4. Many to many (M:M)
One-to-one
One-to-many
Many-to-one
In one-to-many mapping, an
entity in E1 is associated with at
most one entity in E2, and an
entity in E2 is associated with any
number of entities in E1.
Many-to-many
In many-to-many mapping, an
entity in E1 is associated with any
number of entities in E2, and an
entity in E2 is associated with any
number of entities in E1.