Dbms 2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Data Base:

Database is an organized Collection of interselect data, which helps in insertion, deletion and sorting
Data efficiently. The database is also used to organize the data as information in the form of table
view using the database you can easily access update or delete any information.

DBMS:

Data base management system is s/w used for creating and merging the data in the database easily
and efficiently. It is basically a set of program that allows users to store, modify or update and
retrieve info from the database as for the requirement.

DBMS provide security and protection to the database. DBMS acts as a middle layer b/w the
database and user.
Ex - My SQL, My SQL Server, microsoft SQL server are different type of DBMS

Characteristics of DBMS:There are some characteristic of DBMS, which are given below-

DBMS should be able to store any kind of data in database.


DBMS should be able to support ACID (Automicity, consistency, isolation, durability) properly.
The DBMS allow more or one user to occur the same database of some time
Backup and Recovery and the two main methods that allow to user to protect their data from
damage or loss.
It provides multiple view for different uses in one organization.
DBMS follows the concept at normalization to minimise a redundancy(duplicacy) of a relation.
It provides users query language, using which they can easily insert, retrieve update and delete the
data in database.

Advantages of DBMS:
minimal data redundancy or data duplicacy.
Easy access to data from database using query
DBMS provide backup and recovery method which Create an automatic backup of data from
software and hardware failures and stores the data if required.
minimized data consistency.
Better data integration
DBMS can apply integrity Constant to the data database.
DBMS incent consistency and reduces updating.

Disadvantage of DBMS:
A DBMS is complex and time consuming to design.
Cost of h/w & s/w is high to sum DBMS s/w.
DBMS Consume a large amount of main memory as well as huge amount of disk space to make it run
efficiently.
if the database is damaged because af any h/w or s/w failure, all the application Program will be
implecty effected which are dependent on it.
Initial training is required for all the users and programmers to use DBMS Software.

Components/Elements of DBMS:

There are some types of elements in DBMS-


Software
Hardware
Procedure
Data

Name Gyanesh Sharma Roll No-220031150015


User

(i) Software: The main component of DBMS is Software. Set of program which is lised to manage
Database and the control the overall computerized database.
The DBMS Software provide as an easy to use interface to store ,retrieve and update data in the
database.
This Software components is capable at understanding the database access language and convert it
into actual data base and to execute or run them on the database.

(ii) Hardware: This component of the DBMS Consist of a set of physical electronic devices such as
Computers. I/O Channels, Storage devices, etc that creates an interface between Computer & users.
The DBMS Component is used for keeping & storing the data in the database.

(iii) procedure: procedure refers to general, rules & instruction that helps to design the database
and to the DBMS. procedure are use to setup & install a new DBMS to login & logout at DBMS
Software to merge DBMS or application program to take up at the database and to change the
structure of the database etc.

(iv) Data: It is the most important component of DBMS. the main task of DBMS is to process the
data, How DBMS are designed or defined constructed and from the data the database contains
both.

(v)User: The user are the people who control & manage the database and perform different type of
operation on the database is DBMS. there are three type of user who play different role.

(a) Application programmer: The user who write the application programs in programming language
(such as Java, C++, Python, VB etc) to interact with database are called Application programmer.
(b) DBA: A person who manages overall DBMS, is Called DBA
(c) End user: The end user are those who interact with the DBMS to perform different operation by
using the different Database and such as insert, update. delete & retrieve from the data.

Applications of DBMS. there are various fields Where DBMS is used.

Railway Reservation System


Library management
Banking Education Sector
Credit card transaction
Social media Site
Telecommunication
Finance
Online shopping
HRM
Manufacturing
Online Reservation

Data Models
Data models are the models explaining the logical structure of the Database system. They describe
the entity, attributes, relationship among the data elements of the specific data space.
Data model organize the description and consistency constraints after the complete
implementation of the database. these models show how the data represented to each other. and
how they are stored accessed and update inside the database System.

Various Types of Data Models-


1. Flat data model
2. Hierarchical data model
3. Relational data model
4. Entity relationship model.
5. Object oriented data model
6. Object relational data model
7. Network data model.

(1) flat data model


flat data model is that in which kept all the data in the same plane. it is first introduced traditional
dato model which is not much Scientific or specific
In this model the database is indicated as a single table in the form tupples and Column fields the
database system model is slow and inefficient process.

(2) The hierarchical model


The hierarchical model classifies the data into a tree-like structure with a single parent or root for
each record. Sibling records are arranged in a certain sequence. This is the physical order in which
the database is stored. This model is useful for explaining a wide range of real-world interactions.

Advantages:
• It is very simple and fast to traverse through a tree-like structure.
• Any change in the parent node is automatically reflected in the child node so, the integrity of data
is maintained.

Disadvantages:
• Complex relationships are not supported.
• As it does not support more than one parent of the child node so if we have some complex
relationship where a child node needs to have two parent node then that can't be represented using
this model.
• If a parent node is deleted then the child node is automatically deleted.

(3) Network Data model

This paradigm is an expansion of the hierarchical model. It was the most prevalent model prior to
the relational model. The main difference between this model and the hierarchical approach is that a
record can have several parents. It replaces the hierarchical tree with a graph. In the sample below,
we can see that node student has two parents, CSE Department and Library. This was previously not
allowed in the hierarchical model.

Advantages:
• When compared to the hierarchical approach, data may be obtained more quickly. This is because
the data in the network model is more linked and there may be more than one path to a certain
node. As a result, the information may be accessed in a variety of ways.
• Data integrity is present since there is a parent-child connection. Any changes made to the parent
record are mirrored in the child record. Advantages of Network Model Disadvantages of Network
Model

Disadvantages:
• As additional relationships are added, the system may get increasingly complicated. To operate
with the model, a user needs have full understanding of it.
• Any modification, such as an update, deletion, or insertion, is quite difficult.

(4) Relational Data Model

Name Gyanesh Sharma Roll No-220031150015


The most common model is the Relational Model. The data in this model is kept in the form of a
two-dimensional table. All data is saved in the form of rows and columns. Tables are the foundation
of a relational paradigm. In the relational paradigm, the tables are also referred to as relations.
Advantages:
• Simple: This model is more simple as compared to the network and hierarchical model.
• Scalable: This model can be easily scaled as we can add as many rows and columns we want.
• Structural Independence: We can make changes in database structure without changing the way to
access the data. When we can make changes to the database structure without affecting the
capability to DBMS to access the data we can say that structural independence has been achieved.

Disadvantages :
• Hardware Overheads: For hiding the complexities and making things easier for the user this model
requires more powerful hardware computers and data storage devices.
• Bad Design: As the relational model is very easy to design and use. So the users don't need to know
how the data is stored in order to access it. This ease of design can lead to the development of a
poor database which would slow down if the database grows.

(5).Entity Relationship data model.


The Entity-Relationship Model, sometimes known as the ER Model, is a high-level data model
diagram. We express the real-world problem in visual form in this model to make it easier for
stakeholders to grasp. The ER diagram also makes it extremely simple for developers to comprehend
the system. The ER diagram is a visual tool used to depict an ER Model. The ER diagram is made up
of three parts:
Entity
Attributes
Relationship

Advantages:
• Simple: Conceptually ER Model is very easy to build. If we know the relationship between the
attributes and the entities we can easily build the ER Diagram for the model.
• Effective Communication Tool : This model is used widely by the database designers for
communicating their ideas.
• Easy Conversion to any Model : This model maps well to the relational model and can be easily
converted relational model by converting the ER model to the table. This model can also be
converted to any other model like network model, hierarchical model etc.

Disadvantages:
• No industry standard for notation: There is no industry standard for developing an ER model. So
one developer might use notations which are not understood by other developers.
• Hidden information: Some information might be lost or hidden in the ER model. As it is a high-level
view so there are chances that some details of information might be hidden.

(6) OBJECT ORIENTED DATA MODEL


A database, according to this paradigm, is a collection of objects, or reusable software parts, with
related characteristics and operations.
this object identity object structure

• Object-oriented databases are classified into numerous types: A multimedia database contains
media, such as photos, that would be impossible to store in a relational database.
• Any object in a hypertext database can link to any other object. It is effective for organizing a large
amount of heterogeneous data, but it is not perfect for numerical analysis.
• Because it integrates but is not limited to tables, the object-oriented database model is the most
well-known post-relational database paradigm. These types of models are often known as hybrid
database models.

Advantages:

• Complex data sets can be saved and retrieved quickly and easily.
• Object IDs are assigned automatically.
• Works well with object-oriented programming languages.
• Semantic content is added
• Support for complex objects
• Visual representation includes semantic content

Disadvantages:

• Object databases are not widely adopted.


• In some situations, the high complexity can cause performance problems.
• High system overheads slow transactions.

(7).Object relational Data Model:


As the name implies, it is a hybrid of the relational and object-oriented models. This paradigm was
created to bridge the gap between the object-oriented and relational models. We can have many
sophisticated features, such as the ability to create complicated data types based on our needs
utilising current data types. The issue with this paradigm is that it may become complicated and
difficult to manage. As a result, a thorough comprehension of this paradigm is essential.

Advantages:

Codes can be reused due to inheritance.


Easily understandable.
Cost of maintenance can reduced due to reusability of attributes and functions because of
inheritance.

Disadvantages:

It is not properly developed so not accepted by users easily


.

Functional Dependency:
The functional dependency is a relationship that exists between two attributes. It typically exists
between the primary key and non-key attribute within a table.
(i).X   →   Y
Types of Functional dependency: there are six types of functional dependency in dbms which are
given below:-
1.Trivial functional dependency
2.Non-Trivial functional dependency
3.Multivalued functional dependency
4.Transitive functional dependency

1. Trivial Functional Dependency

Name Gyanesh Sharma Roll No-220031150015


In Trivial Functional Dependency, a dependent is always a subset of the determinant. i.e. If X →
Y and Y is the subset of X, then it is called trivial functional dependency
Example:
nam
roll_no e age

42 abc 17

43 pqr 18

44 xyz 18

Here, {roll_no, name} → name is a trivial functional dependency, since the dependent name is a


subset of determinant set {roll_no, name}. Similarly, roll_no → roll_no is also an example of trivial
functional dependency. 
2. Non-trivial Functional Dependency
In Non-trivial functional dependency, the dependent is strictly not a subset of the determinant. i.e.
If X → Y and Y is not a subset of X, then it is called Non-trivial functional dependency.
Example:
nam
roll_no e age

42 abc 17

43 pqr 18

44 xyz 18

Here, roll_no → name is a non-trivial functional dependency, since the dependent name is not a


subset of determinant roll_no. Similarly, {roll_no, name} → age is also a non-trivial functional
dependency, since age is not a subset of {roll_no, name} 
3. Multivalued Functional Dependency
In Multivalued functional dependency, entities of the dependent set are not dependent on each
other. i.e. If a → {b, c} and there exists no functional dependency between b and c, then it is called
a multivalued functional dependency.
For example,
roll_n
o name age

42 abc 17

43 pqr 18

44 xyz 18

45 abc 19

Here, roll_no → {name, age} is a multivalued functional dependency, since the


dependents name & age are not dependent on each other(i.e. name → age or age → name
doesn’t exist !)
4. Transitive Functional Dependency
In transitive functional dependency, dependent is indirectly dependent on determinant. i.e. If a →
b & b → c, then according to axiom of transitivity, a → c. This is a transitive functional dependency.
For example,
enrol_n
o name dept building_no

42 abc CO 4

43 pqr EC 2

44 xyz IT 1

45 abc EC 2

Here, enrol_no → dept and dept → building_no. Hence, according to the axiom of


transitivity, enrol_no → building_no is a valid functional dependency. This is an indirect functional
dependency, hence called Transitive functional dependency.
5. Fully Functional Dependency
In full functional dependency an attribute or a set of attributes uniquely determines another
attribute or set of attributes. If a relation R has attributes X, Y, Z with the dependencies X->Y and X-
>Z which states that those dependencies are fully functional.

6. Partial Functional Dependency:-


In partial functional dependency a non key attribute depends on a part of the composite key, rather
than the whole key. If a relation R has attributes X, Y, Z where X and Y are the composite key and Z is
non key attribute. Then X->Z is a partial functional dependency in RBDMS.
Rules of Functional Dependency :
There are some rules of functional dependency which are given below
1.Reflexivity: If A is a set of attributes and B is a subset of A, then the functional dependency A →
B holds true.
For example, { Employee_Id, Name } → Name is valid.
2.Augmentation: If a functional dependency A → B holds true, then appending any number of the
attribute to both sides of dependency doesn't affect the dependency. It remains true.
For example, X → Y holds true then, ZX → ZY also holds true.
For example, if { Employee_Id, Name } → { Name } holds true then, { Employee_Id, Name, Age } →
{ Name, Age }
3.Transitivity: If two functional dependencies X → Y and Y → Z hold true, then X → Z also holds true
by the rule of Transitivity.
For example, if { Employee_Id } → { Name } holds true and { Name } → { Department } holds true,
then { Employee_Id } → { Department } also holds true.
4.Union:
This rule is also known as the additive rule. In the union rule, if X determines Y and X determines Z,
then X also determines both Y and Z., i.e., If X  ->  Y and X  ->  Z then,
X  -> YZ. 
5.Decomposition:
This rule is the reverse of the Union rule. If X determines Y and Z together in the decomposition rule,
X determines Y and Z separately. i.e If X  -> YZ then ,X ->  Y and X 
Advantages of Functional Dependency in DBMS:
 It is used to maintain the quality of data in the database.
 It expresses the facts about the database design.
 It helps in clearly defining the meanings and constraints of databases.
 It helps to identify bad designs.
 Disadvantages of Functional Dependency in DBMS:
Name Gyanesh Sharma Roll No-220031150015
 They are very easy to define and as defined over columns and no data needed to be
"maintained".
 They can make operations slower when adding new rows, but since typically you will have
an index on the left attribute of the dependency (A in A->B), it will not be that slow.
Normalization:
Normalization is the process of organizing the data in the database.Normalization is used to
minimize the redundancy from a relation or set of relations and It is also used to remove undesirable
characteristics like Insertion, Update, and Deletion Anomalies,Normalization divides the larger table
into smaller and links them using relationships and the normal form is used to reduce redundancy
from the database table.
Anomalies in DBMS: It can be categorized into three types:-
Insertion Anomaly: Insertion Anomaly refers to when one cannot insert a new tuple into a
relationship due to lack of data.
Deletion Anomaly: The delete anomaly refers to the situation where the deletion of data results in
the unintended loss of some other important data.
Updatation Anomaly: The update anomaly is when an update of a single data value requires
multiple rows of data to be updated.
Types of normal forms in DBMS:
there are six types of normal forms in DBMS which are given below
1. First Normal Form : A relation is in 1NF if it contains an atomic value.
2. Second Normal Form: A relation will be in 2NF if it is in 1NF and all non-key attributes are
fully functional dependent on the primary key.
3. Third Normal Form: A relation will be in 3NF if it is in 2NF and no transition dependency
exists.
4. BCNF(Boyce Code Normal Form): A stronger definition of 3NF is known as Boyce Codd's
normal form.
5. Fourth Normal Form: A relation will be in 4NF if it is in Boyce Codd's normal form and has no
multi-valued dependency.
6. Fifth Normal Form: A relation is in 5NF. If it is in 4NF and does not contain any join
dependency, joining should be lossless.
Advantages of Normalization : 
 A more modest information base can be kept up as standardization disposes of the copy
information. Generally speaking size of the information base is diminished thus.
 Better execution is guaranteed which can be connected to the above point. As information
bases become lesser in size, the goes through the information turns out to be quicker and
more limited in this way improving reaction time and speed.
 Narrower tables are conceivable as standardized tables will be tweaked and will have lesser
segments which considers more information records per page.
 Fewer files per table guarantees quicker support assignments (file modifies).
Disadvantages of Normalization :
 More tables to join as by spreading out information into more tables, the need to join table’s
increments and the undertaking turns out to be more dreary. The information base gets
more enthusiastically to acknowledge too.
 Tables will contain codes as opposed to genuine information as the rehashed information
will be put away as lines of codes instead of the genuine information. Thusly, there is
consistently a need to go to the query table.
Introduction to SQL:
Structure Query Language(SQL) is a database query language used for storing and managing data in
Relational DBMS. SQL was the first commercial language introduced for E.F Codd's Relational model
of database. Today almost all RDBMS(MySql, Oracle, Infomix, Sybase, MS Access) use SQL as the
standard database query language. SQL is used to perform all types of data operations in RDBMS.
SQL Command
SQL defines following ways to manipulate data stored in an RDBMS.

DDL: Data Definition Language


This includes changes to the structure of the table like creation of table, altering table, deleting a
table etc.
All DDL commands are auto-committed. That means it saves all the changes permanently in the
database.
Command Description
create to create new table or database
alter for alteration
truncate delete data from table
drop to drop a table
rename to rename a table

DML: Data Manipulation Language


DML commands are used for manipulating the data stored in the table and not the table itself.
DML commands are not auto-committed. It means changes are not permanent to database, they can
be rolled back.
Command Description
insert to insert a new row
update to update existing row
delete to delete a row
merge merging two rows or two tables

TCL: Transaction Control Language


These commands are to keep a check on other commands and their affect on the database. These
commands can annul changes made by other commands by rolling the data back to its original state.
It can also make any temporary change permanent.
Command Description
commit to permanently save
rollback to undo change
savepoint to save temporarily

DCL: Data Control Language


Data control language are the commands to grant and take back authority from any database user.
Command Description

grant grant permission of right

revoke take back permission.

DQL: Data Query Language


Data query language is used to fetch data from tables based on conditions that we can easily apply.
Command Description
select retrieve records from one or more table

Name Gyanesh Sharma Roll No-220031150015

You might also like