You are on page 1of 34

Ques What is DBMS . Explain the basic architecture of DBMS ?

Database

• Database is a collection of inter-related data which is used to retrieve, insert and delete the
data efficiently.
• It is also used to organize the data in the form of table, schema, views and reports etc.

• For example: College Database organizes the data about the admin, staff, students and
faculty etc.

• Using the database, you can easily retrieve, insert and delete the information.

Database Management System

Database management system is software which is used to manage the database.


For example: MySQL, Oracle etc. are very popular commercial database which are used in
different applications.

DBMS allows users the following tasks:

• Data Definition:
It is used for creation, modification and removal of definition that defines the
organization of data in database.
• Data Updating:
It is used for insertion, modification and deletion of the actual data in the database.
• Data Retrieval:
It is used to retrieve the data from the database which can be used by applications for
various purposes.
• User Administration:
It is used for registering and monitoring users, maintain data integrity, enforcing data
security, dealing with concurrency control, monitoring performance and recovering
information corrupted by unexpected failure.

Features of DBMS

• It is used to support manipulation and processing of data.


• It is used to provide security of data.
• It can view the database from different viewpoints according to the requirements of
the user.
• It uses a digital repository established on a server to store and manage the information.
DBMS Architecture ( system structure question is different)

• The DBMS design depends upon its architecture.


• Database architecture depends upon how users are connected to the database to get their
request done.

Types of DBMS Architecture

Database architecture can be seen as single tier or multi-tier.


But logically, database architecture is of two types like: two tier architecture and three tier
architecture.

1-Tier Architecture

• In the 1-Tier architecture, database is directly available to the user. It means user can
directly sits on the DBMS and uses it.
• The 1-Tier architecture is used for development of local application, where
programmers directly communicate with the database for quick response.

2-Tier Architecture

• 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 client side.
• The server side is responsible to provide the functionalities like: query processing and
transaction management.
• To communicate with the DBMS, client side application establishes a connection with
the server side.
3-Tier 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 which further
communicates with the database system.
• 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.
• The 3-Tier architecture is used in case of large web application.
Briefly explain about database system architecture? (2017)
Ques What is Database administrator(DBA)?What are the roles of
DBA.
• Data Base Administrator (DBA) is a person or group in charge for implementing DBMS in an
organization.
• Database Administrator's job requires a high degree of technical expertise and the ability to
understand and interpret management requirements at a senior level. In practice the DBA
may consist of team of people rather than just one person

Roles of DBA :

• Schema definition:

A DBA creates the original database schema by executing a set of data definition statements
in the DDL.

• Installing and Upgrading an SQL Server

The DBA is responsible for installing SQL Server or upgrading an existing SQL Server.

In the case of upgrading SQL Server, the DBA is responsible for ensuring that if the upgrade
is not successful, the SQL Server can be rolled back to an earlier release until the upgrade
issues can be resolved.

3. Performing Backup and Recovery Duties

Backup and recovery are the DBA's most critical tasks; they include the following aspects:

• Establishing standards and schedules for database backups


• Developing recovery procedures for each database
• Making sure that the backup schedules meet the recovery requirements

• Makes decisions concerning the content of the database

It is the DBA's job to decide exactly what information is to be held in the database -in other
words, to identify the' entities of interest to the enterprise and to identify information to be
stored about those entity .

5. Plans storage structures and access strategies:

The DBA must also decide how the data is to be represented in the database, and must
specify the representation by writing the storage structure definition (using the internal DDL).
In addition, the associated mapping between the storage structure definition and the
conceptual schema must also be specified.

6. Provides support to users:

It is the responsibility of the DBA to provide support to the users, to ensure that the data
they require is available, and to write the\ necessary external schemas (using the
appropriate external data definition language).

7. Defines security and integrity checks:


DBA is responsible for providing the authorization and authentication checks such that no
malicious users can access database and it must remain protected.

DBA must also ensure the integrity of the database.

Ques. Differentiate between data, information and knowledge.

In order to understand where the differences and the connections between data,
information and knowledge are, it is necessary to define the terms at first.

Data

• Data (singular: date) are understood differently in different sectors.


• Data means raw facts and figures concerning people, places, or any other thing, which is
expressed in the form of numbers, letters or symbols.
• In the basic form, data are different symbols and characters whose meaning only becomes
clear when they connect with context.
• Collecting and measuring observations generates data.
• Usually machines sent, receive and process data.
• The confusion between data and information often arises because information is made out
of data.
• An example of data: 17091985 – Only with this sequence of numbers is little to begin. If,
however, the information connects to a context, the number sequence can be decrypted
and represents information (date of birth: 17.09.1985).
Information

• The term ‘information’ is described as the structured, organised and processed data,
presented within context, which makes it relevant and useful to the person who wants it.
• Data means raw facts and figures concerning people, places, or any other thing, which is
expressed in the form of numbers, letters or symbols.
• Information is the data which is transformed and classified into an intelligible form, which
can be used in the process of decision making.
• In short, when data turn out to be meaningful after conversion, it is known as information. It
is something that informs, in essence, it gives an answer to a particular question.
• The main characteristics of information are accuracy, relevance, completeness and
availability. It can be communicated in the form of content of a message or through
observation and can be obtained from various sources such as newspaper, television,
internet, people, books, and so on.

Knowledge

• Knowledge means the familiarity and awareness of a person, place, events, ideas, issues,
ways of doing things or anything else, which is gathered through learning, perceiving or
discovering.
• It is the state of knowing something with cognizance through the understanding of concepts,
study and experience.
• In a nutshell, knowledge connotes the confident theoretical or practical understanding of an
entity along with the capability of using it for a specific purpose.
• Combination of information, experience and intuition leads to knowledge which has the
potential to draw inferences and develop insights, based on our experience and thus it can
assist in decision making and taking actions.

Ques2 difference between database system and file system.

File System vs DBMS – Difference between File System and DBMS

File Management System Database Management System


File System is a general, easy-to-use system Database management system is used when
to store general files which require less security constraints are high.
security and constraints.
Data Redundancy is more in file management Data Redundancy is less in database
system. management system.
Data Inconsistency is more in file system. Data Inconsistency is less in database
management system.
Centralisation is hard to get when it comes to Centralisation is achieved in Database
File Management System. Management System.
User locates the physical address of the files In Database Management System, user is
to access data in File Management System. unaware of physical address where data is
stored.
Security is low in File Management System. Security is high in Database Management
System.
File Management System stores unstructured Database Management System stores
data as isolated data files/entities. structured data which have well defined
constraints and interrelation.
These are the criteria which should taken into account when choosing a system to manage
your data.

Ques Discuss three level architecture of dbms. Explain how it leads to


data independence. Or
Discuss the three-schema architecture.

• The three schema architecture is also called ANSI/SPARC architecture or three-level


architecture.
• This framework is used to describe the structure of a specific database system.
• The three schema architecture is also used to separate the user applications and physical
database

In the above diagram:

• It shows the DBMS architecture.


• Mapping is used to transform the request and response between various levels of
architecture.
• Mapping is not good for small DBMS because it takes more time.
• In External / Conceptual mapping, it is necessary to transform the request from
external level to conceptual schema.
• In Conceptual / Internal mapping, DBMS transform the request from the conceptual to
internal level.

This architecture has three levels:


1. External level
2. Conceptual level
3. Internal level

External level

• It is also called view level.


• The reason this level is called “view” is because several users can view their desired data
from this level which is internally fetched from database with the help of conceptual and
internal level mapping.
• The user doesn’t need to know the database schema details such as data structure, table
definition etc.
• User is only concerned about data which is what returned back to the view level after it has
been fetched from database (present at the internal level).
• External level is the “top level” of the Three Level DBMS Architecture.

Conceptual level
• It is also called logical level.
• The whole design of the database such as relationship among data, schema of data etc. are
described in this level.
• Database constraints and security are also implemented in this level of architecture.
• This level is maintained by DBA (database administrator).

Internal level

• This level is also known as physical level.


• This level describes how the data is actually stored in the storage devices.
• This level is also responsible for allocating space to the data.
• This is the lowest level of the architecture.

What is data independence ?

Data Independence
• Data independence can be explained using the three-schema architecture.
• Data independence refers characteristic of being able to modify the schema at one
level of the database system without altering the schema at the next higher level.

There are two types of data independence:

1. Logical Data Independence

• Logical data independence refers characteristic of being able to change the conceptual
schema without having to change the external schema.
• Logical data independence is used to separate the external level from the conceptual
view.
• If we do any changes in the conceptual view of the data, then the user view of the data
would not be affected.
• Logical data independence occurs at the user interface level.

2. Physical Data Independence

• Physical data independence can be defined as the capacity to change the internal
schema without having to change the conceptual schema.
• If we do any changes in the storage size of the database system server, then the
Conceptual structure of the database will not be affected.
• Physical data independence is used to separate conceptual levels from the internal
levels.
• Physical data independence occurs at the logical interface level.
Ques Explain these terms or write short note on:
• Database schema
• Data independence
• Aggregation
• Association
• Specialisation
• abstraction
• Generalisation

DBMS Schema
• Definition of schema: Design of a database is called the schema.

• Schema is of three types: Physical schema, logical schema and view schema.

• For example: In the following diagram, we have a schema that shows the
relationship between three tables: Course, Student and Section.

• The diagram only shows the design of the database, it doesn’t show the data
present in those tables.

• Schema is only a structural view(design) of a database as shown in the diagram


below.
• The design of a database at physical level is called physical schema, how the data
stored in blocks of storage is described at this level.

• Design of database at logical level is called logical schema, programmers and


database administrators work at this level, at this level data can be described as
certain types of data records gets stored in data structures.

• However the internal details such as implementation of data structure is hidden at


this level (available at physical level).

• Design of database at view level is called view schema. This generally describes
end user interaction with database systems.

Generalization
• Generalization is a process in which the common attributes of more than one
entities form a new entity. This newly formed entity is called generalized entity.

Generalization Example
• Lets say we have two entities Student and Teacher.
• Attributes of Entity Student are: Name, Address & Grade

• Attributes of Entity Teacher are: Name, Address & Salary

• The ER diagram before generalization looks like this:

These two entities have two common attributes: Name and Address, we can make a
generalized entity with these common attributes.

Lets have a look at the ER model after generalization.

The ER diagram after generalization:

We have created a new generalized entity Person and this entity has the common
attributes of both the entities.

As you can see in the following ER diagram that after the generalization process
the entities Student and Teacher only has the specialized attributes Grade and
Salary respectively and their common attributes (Name & Address) are now
associated with a new entity Person which is in the relationship with both the entities
(Student & Teacher).
Note:

1. Generalization uses bottom-up approach where two or more lower level entities
combine together to form a higher level new entity.

2. The new generalized entity can further combine together with lower level entity to
create a further higher level generalized entity.

Specialization
• Specialization is a process in which an entity is divided into sub-entities. You can
think of it as a reverse process of generalization, in generalization two entities
combine together to form a new higher level entity.

• Specialization is a top-down process.

• The idea behind Specialization is to find the subsets of entities that have few
distinguish attributes.

• For example – Consider an entity employee which can be further classified as sub-
entities Technician, Engineer & Accountant because these sub entities have some
distinguish attributes.

Specialization Example
• In the above diagram, we can see that we have a higher level entity “Employee”
which we have divided in sub entities “Technician”, “Engineer” & “Accountant”.

• All of these are just an employee of a company, however their role is completely
different and they have few different attributes. Just for the example, I have shown
that Technician handles service requests, Engineer works on a project and
Accountant handles the credit & debit details.

• All of these three employee types have few attributes common such as name &
salary which we had left associated with the parent entity “Employee” as shown in
the above diagram.

Aggregation
Aggregation is a process in which a single entity alone is not able to make sense in
a relationship so the relationship of two entities acts as one entity. I know it sounds
confusing but don’t worry the example we will take, will clear all the doubts.

Aggregation Example
In real world, we know that a manager not only manages the employee working
under them but he has to manage the project as well.

In such scenario if entity “Manager” makes a “manages” relationship with either


“Employee” or “Project” entity alone then it will not make any sense because he has
to manage both. In these cases the relationship of two entities acts as one entity. In
our example, the relationship “Works-On” between “Employee” & “Project” acts as
one entity that has a relationship “Manages” with the entity “Manager”.

Abstraction
Database systems are made-up of complex data structures. To ease the user
interaction with database, the developers hide internal irrelevant details from users.
This process of hiding irrelevant details from user is called data abstraction.
We have three levels of abstraction:

Physical level: This is the lowest level of data abstraction. It describes how data is
actually stored in database. You can get the complex data structure details at this
level.

Logical level: This is the middle level of 3-level data abstraction architecture. It
describes what data is stored in database.

View level: Highest level of data abstraction. This level describes the user
interaction with database system.

Example: Let’s say we are storing customer information in a customer table.


At physical level these records can be described as blocks of storage (bytes,
gigabytes, terabytes etc.) in memory. These details are often hidden from the
programmers.

At the logical level these records can be described as fields and attributes along
with their data types, their relationship among each other can be logically
implemented. The programmers generally work at this level because they are aware
of such things about database systems.
At view level, user just interact with system with the help of GUI and enter the
details at the screen, they are not aware of how the data is stored and what data is
stored; such details are hidden from them.

Ques Define E-r model with example.

Ques What are different types of attributes?

Ques what are weak entities and strong entities ?how they are represented in ER-
diagram

Ques define entity and entity set.

An Entity–relationship model (ER model) describes the structure of a database


with the help of a diagram, which is known as Entity Relationship Diagram (ER
Diagram).

An ER model is a design or blueprint of a database that can later be implemented


as a database.

The main components of E-R model are: entity set and relationship set.

What is an Entity Relationship Diagram (ER


Diagram)?
An ER diagram shows the relationship among entity sets. An entity set is a group
of similar entities and these entities can have attributes.

In terms of DBMS, an entity is a table or attribute of a table in database, so by


showing relationship among tables and their attributes, ER diagram shows the
complete logical structure of a database.

Lets have a look at a simple ER diagram to understand this concept.

A simple ER Diagram:
In the following diagram we have two entities Student and College and their
relationship.

The relationship between Student and College is many to one as a college can have
many students however a student cannot study in multiple colleges at the same
time.

Student entity has attributes such as Stu_Id, Stu_Name & Stu_Addr and College
entity has attributes such as Col_ID & Col_Name.
Here are the geometric shapes and their meaning in an E-R Diagram. We will
discuss these terms in detail in the next section(Components of a ER Diagram) of
this guide so don’t worry too much about these terms now, just go through them
once.

Rectangle: Represents Entity sets.

Ellipses: Attributes

Diamonds: Relationship Set

Lines: They link attributes to Entity Sets and Entity sets to Relationship Set

Double Ellipses: Multivalued Attributes

Dashed Ellipses: Derived Attributes

Double Rectangles: Weak Entity Sets

Double Lines: Total participation of an entity in a relationship set

Components of a ER Diagram
As shown in the above diagram, an ER diagram has three main components:

1. Entity

2. Attribute

3. Relationship

WHAT IS ENTITY AND ENTITY SET

Let's take an example to explain everything. For a School Management Software, we will
have to store Student information, Teacher information, Classes, Subjects taught in each
class etc.

ER Model: Entity and Entity Set


Considering the above example, Student is an entity, Teacher is an entity,
similarly, Class, Subject etc are also entities.
An Entity is generally a real-world object which has characteristics and holds relationships in a
DBMS.
If a Student is an Entity, then the complete dataset of all the students will be the Entity Set
1. Entity
An entity is an object or component of data. An entity is represented as rectangle
in an ER diagram.

For example: In the following ER diagram we have two entities Student and College
and these two entities have many to one relationship as many students study in a
single college. We will read more about relationships later, for now focus on entities.

Weak Entity:

An entity that cannot be uniquely identified by its own attributes and relies on the
relationship with other entity is called weak entity. The weak entity is represented by
a double rectangle. For example – a bank account cannot be uniquely identified
without knowing the bank to which the account belongs, so bank account is a weak
entity.

Difference Between Strong and Weak Entity

• An entity is a unique object in the real world.

• It is described as the set of attributes.

• The collection of the same type of entities together forms the entity set.
• Here, we will discuss two types of entities Strong entity and Weak entity. The weak
entity always depends on the strong entity for its existence.

BASIS FOR STRONG ENTITY WEAK ENTITY


COMPARISON
Basic The Strong entity has a primary The weak entity has a partial
key. discriminator key.
Depends The Strong entity is independent Weak entity depends on the strong
of any other entity in a schema. entity for its existence.
Denoted Strong entity is denoted by a Weak entity is denoted with the
single rectangle. double rectangle.
Relation The relation between two strong The relationship between a weak and a
entities is denoted by a single strong entity is denoted by Identifying
diamond simply called Relationship denoted with double
relationship. diamond.
Participation Strong entity may or may not Weak entity always has total
have total participation in the participation in the identifying
relationship. relationship shown by double line.

2. Attribute
An attribute describes the property of an entity. An attribute is represented as Oval
in an ER diagram. There are four types of attributes:

1. Key attribute

2. Composite attribute

3. Multivalued attribute

4. Derived attribute

1. Key attribute:
A key attribute can uniquely identify an entity from an entity set. For example,
student roll number can uniquely identify a student from a set of students. Key
attribute is represented by oval same as other attributes however the text of key
attribute is underlined.
2. Composite attribute:
An attribute that is a combination of other attributes is known as composite attribute.
For example, In student entity, the student address is a composite attribute as an
address is composed of other attributes such as pin code, state, country.

3. Multivalued attribute:
An attribute that can hold multiple values is known as multivalued attribute. It is
represented with double ovals in an ER Diagram. For example – A person can
have more than one phone numbers so the phone number attribute is multivalued.

4. Derived attribute:
A derived attribute is one whose value is dynamic and derived from another
attribute. It is represented by dashed oval in an ER Diagram. For example – Person
age is a derived attribute as it changes over time and can be derived from another
attribute (Date of birth).

E-R diagram with multivalued and derived attributes:


3. Relationship
A relationship is represented by diamond shape in ER diagram, it shows the
relationship among entities. There are four types of relationships:

1. One to One

2. One to Many

3. Many to One

4. Many to Many

1. One to One Relationship


When a single instance of an entity is associated with a single instance of another
entity then it is called one to one relationship. For example, a person has only one
passport and a passport is given to one person.

2. One to Many Relationship


When a single instance of an entity is associated with more than one instances of
another entity then it is called one to many relationship. For example – a customer
can place many orders but a order cannot be placed by many customers.
3. Many to One Relationship
When more than one instances of an entity is associated with a single instance of
another entity then it is called many to one relationship. For example – many
students can study in a single college but a student cannot study in many colleges
at the same time.

4. Many to Many Relationship


When more than one instances of an entity is associated with more than one
instances of another entity then it is called many to many relationship. For example,
a can be assigned to many projects and a project can be assigned to many
students.

Total Participation of an Entity set


A Total participation of an entity set represents that each entity in entity set must
have at least one relationship in a relationship set. For example: In the below
diagram each college must have at-least one associated Student.
Ques Explain various types of data models with examples.

Data Model is a logical structure of Database.

It describes the design of database to reflect entities, attributes, relationship among


data, constraints etc.

Types of Data Models


There are several types of data models in DBMS. We will cover them in detail in
separate articles(Links to those separate tutorials are already provided below). In
this guide, we will just see a basic overview of types of models.

• Object based logical Models – Describe data at the conceptual and view levels.

1. E-R Model
2. Object oriented Model ()

• Record based logical Models – Like Object based model, they also describe data
at the conceptual and view levels. These models specify logical structure of
database with records, fields and attributes.

1. Relational Model

In this model, data is organised in two-dimensional tables and the relationship is maintained by
storing a common field.
The basic structure of data in the relational model is tables. All the information related to a
particular type is stored in rows of that table.
Hence, tables are also known as relations in relational model.
• Hierarchical Model

This database model organises data into a tree-like-structure, with a single root, to which
all the other data is linked.
The hierarchy starts from the Root data, and expands like a tree, adding child nodes to
the parent nodes.
In this model, a child node will only have a single parent node.
This model efficiently describes many real-world relationships like index of a book, recipes
etc.
In hierarchical model, data is organised into tree-like structure with one one-to-many
relationship between two different types of data, for example, one department can have
many courses, many professors and of-course many students.

3. Network Model

This is an extension of the Hierarchical model. In this model data is organised more like a
graph, and are allowed to have more than one parent node.
In this database model data is more related as more relationships are established in this
database model. Also, as the data is more related, hence accessing the data is also
easier and fast.
This database model was used to map many-to-many data relationships.
This was the most widely used database model, before Relational Model was introduced.

Describe relationship in ER diagram .

ER Diagram: Relationship
A Relationship describes relation between entities. Relationship is represented using
diamonds or rhombus.

There are three types of relationship that exist between Entities.

8. Binary Relationship

9. Recursive Relationship
10. Ternary Relationship

ER Diagram: Binary Relationship


Binary Relationship means relation between two Entities. This is further divided into three
types.
One to One Relationship
This type of relationship is rarely seen in real world.

The above example describes that one student can enroll only for one course and a course will
also have only one Student. This is not what you will usually see in real-world relationships.
One to Many Relationship
The below example showcases this relationship, which means that 1 student can opt for many
courses, but a course can only have 1 student. Sounds weird! This is how it is.

Many to One Relationship


It reflects business rule that many entities can be associated with just one entity. For example,
Student enrolls for only one Course but a Course can have many Students.

Many to Many Relationship


The above diagram represents that one student can enroll for more than one courses. And a
course can have more than 1 student enrolled in it.

ER Diagram: Recursive Relationship


When an Entity is related with itself it is known as Recursive Relationship.

ER Diagram: Ternary Relationship


Relationship of degree three is called Ternary relationship.
A Ternary relationship involves three entities. In such relationships we always consider two
entites together and then look upon the third.
For example, in the diagram above, we have three related
entities, Company, Product and Sector. To understand the relationship better or to define
rules around the model, we should relate two entities and then derive the third one.
A Company produces many Products/ each product is produced by exactly one company.
A Company operates in only one Sector / each sector has many companies operating in it.
Considering the above two rules or relationships, we see that although the complete
relationship involves three entities, but we are looking at two entities at a time.

Participation constraints :

You might also like