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

chapter-1_Dbms[1]

Uploaded by

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

chapter-1_Dbms[1]

Uploaded by

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

Chapter 1:Database Management System

Data: Data are the collection of raw facts and figure which are unorganized, uninterpreted, and
isolated, which doesn’t give any particular sense. They are randomly gathered. So that they can
be processed to obtain the desired result.
Ramesh, 17, itahari, 18
Information: Information are the processed form of data. Information gives a meaning full result
after data are interpreted.
Ramesh 17 year old and lives in itahari 18.
As we know, very organization from the prehistoric time deals with data and information. Data
are very necessary for organization to operate. In previous time, data used to be collected
randomly and were not organized in any particular order which leads to following drawbacks.
• Some information was stored in more than one file. (Data redundancy).
• Difficult to present data from the user’s view.
• Data security was one of the major problem.
• Data processing and manipulation were difficult.
• Data retrieval were very slow.
Hence, concept of database arise in order to overcome the above drawbacks or limitations.
Database is collection of interrelated data or entities stored in tabular form. It gives very
useful information for an organization during data manipulation and decision making. It
provides a base for foundation for managing large volume of data in a well organized manner.
Simply database is a systematic and organized form of data so that user can retrieve or access
data whenever required within no time. For eg, telephone directory, dictionary, marks ledger,
customer records etc.
Roll no. Name Address Contact
1 Hari Bhattarai Biratchowk 009678
2 Ram Dhimal Khotang 006759

In past people used file processing system / flat file system in order to store data and keep
record due to difficulty in processing file and having following limitations. This system are no
longer in use rather people use DBMS in to order Keep record systematically, scientifically
and securely.
Limitations of flat file system.
1. Data security system is one of the major problem in flat file system.
2. Data Sharing was almost impossible or difficult.
3. Some record was stored in more than one file. (Data redundancy)
4. Difficult to represent data through user prospective.
5. It is difficult for processing complex queries.
DBMS (Database Management System):

DBMS is a computerized record keeping system. It is a software that defines, manipulates and
manage the database. It allows to access the file, update the record and retrieve data as
requested. In other word, DBMS is defined as the collection of interrelated data and set of
programs to access there data. The collection of data is usually a database which contains the
information about any particular organization. The primary goal of DBMS is to provide an
effective and efficient environment for both data retrieval and storing data in database. For
example MS Access, Oracle, MY SQL, Fox-Pro, D-base etc

Advantages of DBMS
1) Sharing data: Using DBMS, data stored in database can be shared among multiple users or
computer. For example, branches of bank share data from database.
2) Reduce data redundancy: Data redundancy refer to duplication or repetition of same data over
and over. DBMS reduces such type of unnecessary repetition of data.
3) Data backup and recovery: Using DBMS, we can easily create spare copy of original files and
documents that can be later used in case of accidental or intentional loss and damages.
4) Data security: Using DBMS we can restrict use of database to the unauthorized person. It helps
to ensure date security.
5) Multiple user interface: DBMS facilitates sharing of data which means same data can be
accessed from multiple device and location. Hence, user can experience multiple interface to
access same set of data.
6) Data Integrity: Data Integrity refers to consistency of data. Using database we can arrange same
sort of data in a like order. We can define and enforce constraints for data integrity.

Disadvantages of DBMS
1) Expensive: It may be expensive to run and operate DBMS for any organization.
2) Changing Technology: It is very much difficult to incorporate latest changing technology in
existing system. In order to create and maintain database technical manpower and trainings are
required.
3) Backup is needed: Since data maybe damage anytime accidentally or intentionally. So, it is
mandatory to create a backup.

Database Model:(important)

There are different forms of Database Management system. Each characterized by the way where
data are defined and structured. This arrangement of data in several structure are known as data
base model. Different types of database model. Click here for full explanation with pros, cons and
diagram.
Hierarchical database model:(figure book bata)

It is one of the oldest type of database model. In this model data are represented in the forms of
record, each record has multiple field or attributes. All records are arranged in database as tree
like structure. The relationship between the records is called parent child relationship in which
one child record relates to only a single parent i.e child posses property only property of a single
parent. Here child are restricted to use the property of a parent to whom it doesn't belong.

Advantages
It is the simplest and the easiest model.
It supports one to one or one to many relationship.
Searching is easier and faster if parent is known.
Disadvantages
It is an old fashion and outdated database model.
It doesn’t support many to one relationship.
It doesn’t reduce data redundancy because some data are written over different places.

Network database model:(figure book bata)

This network model replace hierarchical model due to some limitation on the model. Suppose an
employee relates to two different department then hierarchical model cannot be able to arrange
record in proper place. So, network database model was emerged to arrange non-hierarchical
database. The structure of database is more like graph rather than tree structure. A network
model consists of collection of record which are interrelated to each other with the help of
relationship. Each records have multiple fields and each field has only one data value. In this type
of model a parent may have multiple child, as well as child can have multiple parent.

Advantages
✓ It accepts many to many relationships. So, It is more flexible .
✓ It reduces data redundancy.
✓ This network mode is simple and easy to design.
✓ Searching is faster due to use of multi-directional pointer.
Disadvantages
✓ Needs long program to handle the relationship.
✓ Lack of structural independence.
✓ Less security

Relational database model:(figure book bata)


In relational database model, the data are organized into tables which contains multiple row and
columns. These tables are called relations. A row in a table represents a relationship among a set
of values. Since, a table is collection of such relationship. It is generally referred to the
mathematical term relations from which the relational database model derives its name. It is also
known as RDBMS.
Note: The database system which stores and display data in tabular format of rows and column
like spreadsheet is known as RDBMS. It is the most practical DBMS those days. For example, MS-
Access, MY SQL, Oracle etc
Advantages
• There is less data redundancy.
• Breaking of complex database into simple is very much easier.
• Database processing is faster than other model.
Disadvantages
• Establishing more relationships complex.
• It requires powerful computer and data storage device.
• Centralized database VS Distributed database

Structure query Language (SQL):


SQL is a relational language which offers a mechanism of universal database access. SQL is used
as an intermediary and a standard in accessing a large number of different types of database
system. There are many types of statements, but the most commonly used types are two:

i. DDL (Data Definition language)


DDL is used by the database designer and programmers to specify the content and
structure of the database. It is used to define the physical characteristics of records. It is
a link between the logical and physical structures of the database. The logical structure of
the database is called schema.
a) Create( used to create a new database or object , such as table ,index, column etc.
create table student_info(
student_id int primary key,
Name char(50),
address char(50),
phone_no int
);
b) Alter( used to reconstruct the data in database)
For example:
alter table student_info
add gender char(1);

c) Drop: used to delete a table in the database or an entire database.


For example:
Drop table Student_info;

d) Truncate : used to delete all the entries from the table.


For example:
Truncate table student_info;

ii. DML (Data Manipulation language)


DML provides the techniques for processing the database, such as retrieval, sorting,
display and deletion of a data or record. It provides a user to query a database and receive
summary reports. It is integrated with other programming languages so as to implement
sophisticated database functions. DML writes programs to build updates and retrieve data
from the database.
A) Insert: used to insert new records in a table. For example:
insert into student_info (Roll_no,Name,address,phone_no) values ('1','Harry','england','984');

b) update: used to modify records as specified condition.


For example:
update student_info set phone_no='9843' where roll_no='1';

c) Delete : deletes the records as specified condition.


For example: Delete from student_info where name=’Harry’ ;

d) Select: used to retrieve data from table.


For example:
Select * from student_info where name=’harry’; (displays all the records where name is
harry.)
Select * from student_info where name like ‘%y’; ( displays all the records where name
ends with ‘y’)
Select * from student_info where name like ‘h%’; (displays all the records where name
starts with ‘h’)
Entity Relationship Database model (ER Model):

Advantages of E-R diagram

a) It provides a visual representation of the database design.


b) It is simple and easier to understand
c) It is highly flexible to use as additional relationships can be added as per need.
d) It supports physical database creation.
e) It provides a higher-level description of the system.

Centralized database VS Distributed database

Centralized database:
It is a simple type which works on client server basis. In this type clients or user are directly
connected to the centrally totally located server. This server hosts the data of its client or user and
helps them to store and retrieve data as requirement. This type of system are used in small scale
industries which doesn't have to deal with large volume of data and user. Centralized database
runs on single computer which may have single or multiple user. Since database is centralized,
security is not a crucial part here. The maintenance of database is easier because of data are
centrally stored. This type of system denote allow unauthorized person to access data.
Advantages
• Suitable for small scale industries.
• Operation and maintenance is easier.
• Since it prevent unauthorized person being accessed to database, it minimizes risk factor.
Disadvantages
• Data are not secured in this type of system.
• Not suitable for large scale industries.
• Failure of centrally located serves will collapse whole network.

Distributed(Decentralized) database:
In a decentralized database model or distributed database model, the database is stored on
several computers. Distributed databases are databases located at different places. They facilitate
easy access to data from any location. It has the problem of controls of security, increased the
problem of control of database and need more computer resources. It can manage people with
functional knowledge.
Advantages
✓ Failure of a site doesn't affect the whole computer system.
✓ It is much reliable as compared to the centralized database system.
✓ The performance and service are better than centralized database system.
✓ It is suitable for a big organization with a large amount of data, database users, and
computers.
✓ Due to the use of multiple servers, it can support a large numbers of users and
computers at the same time.
Disadvantages
✓ Very expensive to operate and maintain.
✓ Data security may be real issue.

Normalization (v.imp)

Normalization is the process of decomposing a big table into much smaller and simplest
tables. The advantages or importance of Normalization are as follows:

a) It reduces data redundancy.


b) It improves faster sorting and index creation.
c) It creates few indexes and nulls.
d) It ignores repetition of information.
e) It simplifies the structure of tables.
f) It avoids loss of information.

The first three stages of Normalization are

i. First Normal Form (1NF)


ii. Second Normal Form (2NF)
iii. Third Normal Form (3NF)

i. First Normal Form (1NF)


A relation or table is said to be in 1NF if it's all attributes are atomic. That is, there
should not be any repeating groups of an attribute. The purpose of 1NF is to eliminate
repeating groups of attributes in an entity. In other words, if any characteristic is repeat again
and again in the same table/row, then such attributes are removed either into a separate
table or decomposed into different rows.

ii. Second Normal Form (2NF)


A relation is said to be second normal form if it is in first normal form and each attributes
is functionally dependent on the entire primary key. The purpose of 2NF is to eliminate
partial key dependencies. In other words, each attributes in the table must depend on the
whole key, not just the part of it. For e.g. in the above table, the primary key is the
combination of ' Roll_no+Class'. The dependencies of other attributes on this primary
key:

Name depends on Roll_no and Class


Subject depends on Class, not on Roll_No
Marks depends on Subject and Name
So, the above table can be decomposed into the following tables:

i. Third Normal Form (3NF)


A relation is said to be in third normal form if it is in second normal form and it does not
contain any transitive dependency on the primary key. All attributes that is not
dependent upon primary key must be eliminated. A transitive dependency is the one
which, among 3 attributes A, B, C, if A->B, B->C then C->A. A relation in 3NF should not
contain transitive dependency as shown above.
Demonstrate Primary key and alternate key with an example.

Candidate key
All attributes combinations inside a relation that can be used to uniquely identity required
record are candidate keys. A relation can have multiple candidate key.
Primary key
Primary key is a candidate key chosen by a database designer to identify the entity from the
entity set. It uniquely identifies the all records of table. Although several candidate keys may
exist, one of the candidate keys is selected to be the primary key.
Alternate key
In the case of two or more candidate keys, only one of them servers as primary key. An
alternate key is the candidate key which is not used as the primary key.
For eg.
Student(Sudent_id, Name, Roll_no, Class_id)
In the above example, Student is the Entity and student_id, Name, Roll_no and Class_id are
the attributes. If we see the attributes Student_id, Roll_no and Class_id, all of them can
uniquely identify the record that's why all of them are candidate key. Only one of them can
be the primary key in the table so its choose Student_id as the primary key and theremaining
attributes Roll_no and Class_id are the alternate key.

Data integrity: is a rule that restricts the values that may be present in the database.
Data integrity ensures that changes made to the database by authorized users do not result
in a loss of data consistency.
The different types of data integrity are as follows:
a. Entity integrity: Entity integrity is the rule that no column that is part of the primary key
may accept null values. Entity integrity prevents the primary key form accepting null
values and ensures that one record can be distinguished from another.
b. Referential integrity: The referential integrity rule states that if table A contains aforeign
key that matches the primary key of table B, then values of this foreign key either must
match the value of the primary key for some row in table B or must be null.
c. Domain integrity: Domain constraints specify the set of possible values that may be
associated with an attribute. Such constraint may also allow the use of null values for
particular attributes.

Frequently Asked Questions:

• What is SQL? Describe the DML with an example. [2+3]


• Explain about DDL and DML commands in SQL with examples.
• Explain the advantage of Database Management system (DBMS).

• Explain Relational database model with its advantages and disadvantages.

• What is E-R diagram? Write the meaning of graphical symbols used in E-R diagram.
• Write the advantage of ER-diagram.
• Explain the different types of data integrity in DBMS. [5]
• What is database? List out the advantages of Database Management System (DBMS).
[1+4]
• Explain the benefits of decentralized database models. [5]
• What is DBMS? Differentiate between centralized and distributed database. [5]
• Who is DBA? What are the roles of DBA? Explain.[5]
• Explain the database model with suitable examples. list all models and explain each
shortly.]
• What are the importances of normalization? Explain second and third normal form
with example. [2+6]
OR

What is 1NF and 2NF normalization principle in Database? Explain. [5]


OR

Describe the normalization in database. [5]

You might also like