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

unit 1 DMS-1

This document provides an overview of Database Management Systems (DBMS), including definitions of key concepts like data, information, and various database models such as relational, hierarchical, and network models. It discusses the advantages and disadvantages of using DBMS, the importance of normalization, and the differences between Data Definition Language (DDL) and Data Manipulation Language (DML). Additionally, it covers the structure of databases, including fields, records, keys, and the concept of centralized versus distributed databases.

Uploaded by

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

unit 1 DMS-1

This document provides an overview of Database Management Systems (DBMS), including definitions of key concepts like data, information, and various database models such as relational, hierarchical, and network models. It discusses the advantages and disadvantages of using DBMS, the importance of normalization, and the differences between Data Definition Language (DDL) and Data Manipulation Language (DML). Additionally, it covers the structure of databases, including fields, records, keys, and the concept of centralized versus distributed databases.

Uploaded by

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

Unit-1.

Database
Management System
Total marks: 8 marks
Short question: 5 marks
MCQ : 1 marks
1.1 Introduction to data, Information, database, Database
system, DBMS
Data
 Data are the raw facts and figures that can be obtained after some
experiments or observations. Each piece of data is a little fact that
doesn’t mean much on its own.
 Raw data is of no use until and unless we process it to find some useful
information from it.
 It is the unprocessed data, that contains numbers, statements and
characters before it is refined by the researcher
Information:
 The processed data which gives some or complete meaning is called
information.
 Information is organized or classified data, which has some meaningful
values for the receiver.
Data processing cycle:
Data processing is the re-structuring or re-ordering of data by people or
machine to increase their usefulness and add values for a particular
purpose.
A Database
 A database is a collection of interrelated information that is organized so
that it can be easily accessed, managed and updated.
 Database is actually a place where related piece of information is stored
and various operations can be performed on it. Data gets updated,
expanded and deleted as new information is added.
 For example, university database for maintaining information about
students, courses and grades in university.
Database Management System
 Management of data involves a way to store data and also provides a
mechanism for manipulation of that data. Database management
systems are basically designed to manage large volume of information
 It also helps to control access to the database.
 A database system is basically just a computerized record-keeping
system.
 The primary goal of DBMS is to store and retrieve data in both
convenient (easy method) and efficient (capable of performing well)
manner.
 Some of the examples of DBMS are Oracle, SQL-Server, MySQL, MS
Access etc.
A database management system (DBMS) consists of several components. Each
component plays very important role in the database management system environment. The
major components of database management system are:
 Software
 Hardware
 Data
 Procedures
 User
1.2 Field, Record, Objects, Primary Key, Alternate key, Candidate key

Field(attributes)
A table consists of several records(row); each record can be broken into
several smaller entities known as Fields.
The below Employee table consist of four fields, ID, Name, Age and Salary.
Record(tuples)
A single entry in a table is called a Record or Row.
A Record in a table represents set of related data.
Object
A database object is any defined object in a database that is used to store or reference
data. Anything which we make from create command is known as Database Object. It
can be used to hold and manipulate the data. Some of the examples of database objects
are : view, sequence, indexes, etc.

•Table – Basic unit of storage; composed rows and columns


•View – Logically represents subsets of data from one or more tables
•Sequence – Generates primary key values
•Index – Improves the performance of some queries
•Synonym – Alternative name for an object
Primary Key
 A primary key is a special relational
database table column (or combination
of columns) designated to uniquely
identify each table record.
 A primary key is used as a unique
identifier to quickly parse data within
the table. A table cannot have more
than one primary key.
A primary key’s main features are:
•It must contain a unique value for each
row of data.
•It cannot contain null values.
•Every row must have a primary key
value.
Candidate key
A candidate key is a specific type of field in a relational database that can identify
each unique record independently of any other data.
A candidate key of having "no redundant attributes" and being a "minimal
representation of a tuple" in a relational database table.Tuple is one record (one
row)
Alternate Key
Alternate Key or Secondary Key is the key that has not been selected to be the
primary key, but are candidate keys. However, it is considered a candidate key
for the primary key. A candidate key not selected as a primary key is called alternate
or secondary key.
Foreign key:
Foreign key references the primary key of another table. it
helps to connect your tables. Unlike primary key , they do
not have to be unique.
Foreign key can be null even though primary keys cannot
be.

Members Faculty Membership Teachers subject


•hip id
Foreign key id name primary
1 key Arts 1 Rabin english
Shrestha
1 Science
2 Krishna chy Nepali
2 Management
3 Harish pathak Hotel
3 Hotel management
management
• Composite key:
A composite key is a key composed of multiple columns used
to identify a record uniquely.
Composite key
Ramesh Btm Class 11 science
Ramesh damak Class 12 Science

Names are common so you need name as well as address to


uniquely identify a record.
1.3 Advantages of using DBMS
 Controlling redundancy: Minimizing duplicate data/ waste storage
Elimination of inconsistency: All data appears consistently across the database and
the data is same for all the users viewing the database. Moreover, any changes made to
the database are immediately reflected to all the users and there is no data inconsistency.
Sharing of Data: The database administrator manages the data and gives rights to
users to access the data.
Data Integrity: Data integrity means that the data is accurate and consistent in all the
databases and for all the users.
Data Security: Only authorized users should be allowed to access the database and
their identity should be authenticated using a username and password.
Backup and Recovery
Improved data access
Improved decision making
Disadvantage:
Increased cost
Management complexity
Frequent upgrade cycles.
Required technical manpower. etc
Structured Query
Language (SQL)
Structured Query Language is a
standard Database language that is
used to create, maintain, and
retrieve the relational database.
1.4 DDL (Data Definition Language) and DML (Data Manipulation
Language)
Data Manipulation Language
Data Manipulation Language or DML is a subset of operations used to insert, delete, and
update data in a database. A DML is often a sub language of a more extensive language
like SQL; DML comprises some of the operators in the language. DML is an abbreviation
for Data Manipulation Language. Represents a collection of programming languages ​
explicitly used to make changes to the database, such as:
•CRUD operations to create, read, update and delete data.
•Using INSERT, SELECT, UPDATE, and DELETE commands.
•DML commands are often part of a more extensive database language, for example, SQL
(structured query language). These DMLs can have a specific syntax to handle data in that
language.

Data Definition Language


Data Definition Language (DDL) is a standard for commands that define the different
structures in a database. DDL statements create, modify, and remove database objects
such as tables, indexes, and users. Common DDL statements are CREATE, ALTER, and
DROP. DDL statements are similar to a computer programming language for defining data
structures, especially database schemas.
Differences between DML and

DDL DDL
DML
It stands for Data Definition Language. • It stands for Data Manipulation Language.
• It is used to create database schema and • It is used to add, retrieve or update the
can be used to define some constraints data.
as well. • It add or update the row of the table.
• It basically defines the column These rows are called as tuple.
(Attributes) of the table. • It is further classified into Procedural and
• It doesn’t have any further classification. Non-Procedural DML.

• Basic command present in DDL are • BASIC command present in DML are
CREATE, DROP, RENAME, ALTER etc. UPDATE, INSERT, MERGE etc.

• DDL does not use WHERE clause in its • While DML uses WHERE clause in its
statement. statement.
Procedural DML: it requires a user to specify what data are needed and how to get
those data.
Non-Procedural DML: it requires a user to specify what data are needed without
specifying how to get those data.
1.5 Database Model: Network Model, Hierarchical
Model, Relational database model
A database model defines the logical design and structure of
a database and defines how data will be stored , accessed
and updated in a DBMS.
Network Database Model
A network database model is a database model that allows multiple
records to be linked to the same owner file.
The model can be seen as an upside down tree where the branches
are the member information linked to the owner, which is the
bottom of the tree.
The multiple linkages which this information allows the network
database model to be very flexible. In addition, the relationship that
the information has in the network database model is defined as
many-to-many relationship because one owner file can be linked to
Network Database Model
Advantage:
1. more flexible than hierarchicial database model because it accept
many to many relationship.
2. searching is faster of multidirectional pointers.
3. promotes database integrity
4. data independences
Disadvantage:
5. less secure than hierarchical as it is open to all
6. need long program to handle relationship
7. pointer is used in this database and that increased the overhead
storage
8. lack of structural independences.
Hierarchical Database Model
A hierarchical model represents the data in a tree-like structure in which there is
a single parent for each record. To maintain order there is a sort field which keeps
sibling nodes into a recorded manner. These types of models are designed
basically for the early mainframe database management systems, like the
Information Management System (IMS) by IBM.
This model structure allows the one-to-one and a one-to-many relationship
between two/ various types of data. This structure is very helpful in describing
many relationships in the real world; table of contents, any nested and sorted
information.
Hierarchical Database Model
Advantages:
1. it is the easiest model of database
2. it is secure model as nobody can modify the child without consulting to
its parent.
3. searching is fast and easy as parent is known
4. very efficient in handlimg one to many relationship

Disadvantages:
5. it is old fashion , outdated database model.
6. modification and addition of child without consulting its parent is
imposible.
7. cannot handle many to many relationships.
8. increase redundancy
9. it doesnot support flexible data access , because data can be accessed
only by following the path down the tree structure.
Relational Database Model
In this model, data is organized in two-dimensional tables and the relationship is maintained by storing
a common field.
This model was introduced by E.F Codd in 1970, and since then it has been the most widely used
database model, infact, we can say the only database model used around the world.
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.
Relational Database Model
Advantage:
1. very less redundancy of data in this model
2. normalization of database is possible in this model.
3. quick database processing is possible.
4. since one table will link with another with common key field , the rule is
implemented in one table can easily be implemented in another.

Disadvantage:
5. this model uses the complex data structure to store the so it is more
complex than other models.
6. too many rules makes database non-user friendly.
1.6 Concept of Normalization: 1NF, 2NF, 3NF
Normalization
Normalization is the process of breaking down a table into larger number of small
tables to preserve the loss of data and removes unnecessary data.
Normalization is used to minimize the redundancy from a relation or set of
relations. It is also used to eliminate the undesirable characteristics like Insertion,
Update and Deletion
Normalization divides the larger table into the smaller table and links them using
relationship.

First Normal Form


A relation(table) is called 1NF if all the attributes domain of the relations are
atomic and the attributes are unique and single.means it should not contain multi-
valued attributes.

1NF (First Normal Form) Rules


1. Each table cell should contain a single value.
2. Each record needs to be unique.
Example: Normalization
1NF (First Normal Form) Rules Course Subjects
1. Each table cell should contain a single value.
111 Maths, Physics
2. Each record needs to be unique.
222 Biology
333 Chemistry

Here, we rearrange the table and created a new table to form a 1NF.

Course Subject
111 Maths
111 Physics
222 Biology
333 Chemistry
Second Normal Form

To be in second normal form, a relation must be in first normal form and relation
must not contain any partial dependency.
A relation is in 2NF if it has No Partial Dependency, i.e., no non-prime attribute
(attributes which are not part of any candidate key) is dependent on any proper
subset of any candidate key of the table.

2NF (Second Normal Form) Rules

Rule 1- Be in 1NF
Rule 2- It should not have any partial dependencies. i.e. every non key attribute
should be fully functionally dependent on the primary key.
2NF (Second Normal Form) Rules
Rule 1- Be in 1NF
Rule 2- It should not have any partial dependencies. i.e. every non key attribute
should be fully functionally dependent on the primary key.
IDStu IDProf Stu_name Prof_name
S1 P1 Bijay Oli
S2 P2 Rajiv Prachanda
S3 P3 Kamal Baburam

Prof_name is functionally dependent on attribute IDProf. (IDProf --> Prof_name)


The attribute StudentName is functionally dependent on IDStu. (IDStu-->
Stu_name)
IDStu Stu_name IDProf Prof_name
S1 Bijay P1 Oli
S2 Rajiv P2 Prachanda
S3 Kamal P3 Baburam
Third Normal Form

A relation is in third normal form, if there is no transitive dependency for


non-prime attributes as well as it is in second normal form. It should not
have transitive dependency.

3NF (Third Normal Form) Rules


Rule 1- Be in 2NF
Rule 2- Has no transitive functional dependencies

A transitive dependency is: if A,B and C is the attributes in a relation R


and A B,
B C then we can derive A C using functional dependency.
3NF (Third Normal Form) Rules
Rule 1- Be in 2NF
Rule 2- Has no transitive functional dependencies
Stu_id Stu_nam City Zip_code
e

Stu_id Stu_nam City City Zip_code


e
Question
Roll Name Department Year Hostel Name
101 Raman Physics 1 Ganga
102 Krishna Chemistry 2 Kaveri
103 Gopal Computer 3 Godavari
104 Maya Business 1 Ganga

And solution in 3NF.


Roll Name Department Year Year Hostel Name
101 Raman Physics 1 1 Ganga
102 Krishna Chemistry 2 2 Kaveri
103 Gopal Computer 3
3 Godavari
104 Maya Business 1
1.7 Centralized Vs. Distributed Database
Centralized Database System
A centralized database (sometimes abbreviated CDB) is a database that is located,
stored,
and maintained in a single location. This location is most often a central computer
or
database system, for example a desktop or server CPU, or a mainframe computer.
In most cases, a centralized database
would be used by an organization (e.g. a
business company) or an institution (e.g. a
university.), banks etc.

The centralized database system consists


of a single processor together with its
associated data storage devices and other
peripherals. It is physically confined to a
single location. Data can be accessed from
the multiple sites with the use of a
computer network while the database is
maintained at the central site.
• Advantage of centralized database:
 Control
 High security
 Maintenance
 Speed
 Cost
 Minimum data redundancy
Disadvantage:
 Increase cost
 Should be dependent in centralize database.
 Failure in central database effects whole user from access.
 Highly skilled manpower is required to handle database.
 Large data storage.
 Data traffic
Distributed Database

A logically interrelated collection of shared data, physically distributed over a


computer network is called as distributed database and the software system that
permits the management of the distributed database and makes the distribution
transparent to users is called as Distributed DBMS.
It consists of a single logical database
that is split into a number of fragments.
Each fragment is stored on one or more
computers under the control of a
separate DBMS, with the computers
connected by a communications
network.
As shown, in distributed database
system, data is spread across a variety
of different databases. These are
managed by a variety of different DBMS
software running on a variety of
different operating systems. These
machines are spread (or distributed)
geographically and connected together
Advantage of distributed database:
 Transparency
 Reliability and availability
 Improved performance
 Easier expansion
 Sharing
 Efficient and flexible
 Capacity and increment growth
Disadvantage:
 Complex and costly
 Security issues
 Data integrity problem
 Chance of data redundancy.
 Backup problem
 Less data consistency etc
Differences between Centralized and
Distributed database system
Distributed database
Centralized database
• It is a database which consists of multiple
• It is a database that is stored, located as well as databases which are connected with each other
maintained at a single location only. and are spread across different physical locations.
• The data access time in the case of multiple • The data access time in the case of multiple users
users is more in a centralized database.
is less in a distributed database.
• The management, modification, and backup of • The management, modification, and backup of
this database are easier as the entire data is
this database are very difficult as it is spread
present at the same location.
across different physical locations.
• This database provides a uniform and complete
• Since it is spread across different locations thus it
view to the user.
is difficult to provide a uniform view to the user.
• This database has more data consistency in
comparison to distributed database.
• This database may have some data replications
thus data consistency is less.
• The users cannot access the database in case of
database failure occurs.
• In distributed database, if one database fails users
have access to other databases.
1.8 Database Security
Database security refers to the various measures organizations take to
ensure their databases are protected from internal and external threats.
Database security includes protecting the database itself, the data it contains,
its database management system, and the various applications that access
it.
Types of database security controls:
1. Authentication
2. Access control
3. Flow control
4. Encryption
5. Backup and recovery
6. Using power protection devices
7. Use of firewall and antivirus
8. Database monitoring and auditing
Database Administrator
The database administrator is in charge of
managing the primary (database) and secondary
(DBMS and related software) (DBA). The DBA is in
charge of granting access to the database,
organizing and overseeing its use, and procuring
necessary hardware and software resources.
Roles of a Database Administrator
Here are some of the responsibilities of a DBA:
Database design: In larger organizations, DBAs may design databases
and oversee their construction.
Database maintenance: DBAs are responsible for maintaining the
database and ensuring that data is stored and retrieved correctly.
Database security: DBAs ensure the security of the database and enforce
policies and procedures specific to it.
Database performance: DBAs tune the performance of the database
and monitor it regularly.
Database backup and recovery: DBAs are responsible for backing up
the database and ensuring it can be recovered if needed.
Database training and support: DBAs provide training and support to
users of the database.
Collaboration with business users: DBAs work with business users
to ensure the database meets their needs and is performing efficiently.

You might also like