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

Dbms

Uploaded by

supremeshah.63
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Dbms

Uploaded by

supremeshah.63
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

DATABASE MANAGEMENT SYSTEM

Data:
● Facts or figures to be processed which are in the form of text,
observations, figures, images, numbers, graphs, or symbols.
● Data is a raw facts wich are composed of alphabet, number and
some symbols.
● It may or may not give any sense.

Example: 1 Sabin lamjung

Information
It refers to data that has been processed or organized in a meaningful
way.

Roll no Name Address

1 Sabin Lamjung
Database:
Database is a collection of interrelated data of entities or objects which is
stored in a computer in a such a way that it can be easily accessed by
user.
Example:
Phone diary, result sheet etc.
DATABASE MANAGEMENT SYSTEM

DATABASE MANAGEMENT SYSTEM(DBMS):

• DBMS is the collection of interrelated data and set of programs to access


those data.
• The collection of data is usually database which contains the information
about any particular.
• It is a software that defines, manipulates and manages the database.
• It allows to access the files, update the records and retrieve data as
requested.
• It provides an efficient and effective environment for data retrieval and
storing data in database.
Example :
Dbase, My SQL, MS SQL Server etc.
DATABASE MANAGEMENT SYSTEM

Logical structure of DBMS:

User may be persons or application from external environment that supplies various
requests to the system. The database system checks for the requests and performs
various activities as per the need of users.

Some major activities of database are:


• Adding new file to database e st
e qu
• Inserting data into the database file R
• Retrieving data from the database
• Updating data in existing database file
• Deleting data from the database file Request
• Removing files from the database
Re
qu
es
t
DATABASE MANAGEMENT SYSTEM

Objective of Database:

• Elimination of data redundancy


• Share data among all users
• Lower the cost of storing and retrieving data
• Improve accuracy and consistency
• Provide data security from unauthorized access and use
• Exercise central control over standards
• Get persistency in data
• User friendly
• Standard and can be global as well
DATABASE MANAGEMENT SYSTEM

Advantages of DBMS:
• Data Centralization: DBMS allows for centralizing data storage, eliminating
the need for multiple copies of the same data. This promotes data
consistency and reduces data redundancy.

• Data Sharing: DBMS enables multiple users to access and share data
concurrently. User can access the same database for different purpose.

• Data Integrity: It means data accuracy, consistency and up to date.

• Data Security: DBMS offers security features such as user authentication,


access control, and data encryption. It helps protect sensitive data from
unauthorized access.
DATABASE MANAGEMENT SYSTEM

• Reduced data redundancy: the same data can be duplicated at many times or
places, is called data redundancy. DBMS reduces such type of duplication of
data from database.

• Data back up and recovery: DBMS provides backup facilities to store data for
future use. If any file list in any computer, it is possible to restore them from
database server.
DATABASE MANAGEMENT SYSTEM
Disadvantages of DBMS:

Cost: Implementing and maintaining a DBMS can be expensive. It requires


specialized hardware, software licenses, and skilled personnel for installation,
configuration, and administration.

Complexity: DBMS can be complex to design, set up, and manage. It requires a
deep understanding of database concepts.

Changing technology: user have to learn new updates regularly because of the
change in technology.

Needs technical training: it is complex to understand and implement. So, proper


training is required for staff to work properly in the database system.

Backup is needed: data stored in database needs to backup which adds cost
as new storage space are needed.
DATABASE MANAGEMENT SYSTEM

Fields:
Fields, also known as columns or attributes, represent the individual data elements
within a table. Each field holds a specific type of data, such as numbers, text,
dates, or binary data.
For example, in a table representing student information, fields could include
“S_ID," “S_Name," "Email," and "Phone"

Records:
A record, also called a row or tuple, is a complete set of related data within a table.
It consists of a collection of values that correspond to the fields defined in the
table.
Example: 15," “sabin," “[email protected]," and “01 22222"

Tables:
A table is a structured collection of related records, organized in rows and
columns. Tables are used to store and manage data in a structured manner,
providing a way to retrieve, update, and manipulate information.
DATABASE MANAGEMENT SYSTEM

Table: student

S_id S_name Email phone


1 Sabin [email protected] 01 222222
2 Raj [email protected] 01 333333
3 sabina [email protected] 01 444444

In this example, the table “student" has four fields: “S_ID," “s_Name,"
"Email," and "Phone." Each row represents a record, and the table contains
two records with specific values for each field.
DATABASE MANAGEMENT SYSTEM

Database language:

• Database language are used to create, read, update


and store data in a database.
• Structured Query language is an standard database
query language for accessing and managing data in
the database.
• It is not a complete programming language, it is used
for communicating with database.
• It provides platform which allows the user to query a
database.
• SQL can perform various tasks like creating a table,
adding data to tables, dropping the table, modifying
DATABASE MANAGEMENT SYSTEM

DDL (Data Definition Language):


• DDL is used to define and manage the structure of the database.
• DDL is a set of SQL commands used to create, modify, and delete database
structures.
• It is used to specify the content and structure of table.
• DDL statements do not directly manipulate data, but rather define the database
structure.
• It is used to define physical characteristics of records.

List of DDL commands:

CREATE: Used to create the database or table.


DROP: Used to delete table from the database.
ALTER: Used to alter the structure of the database.
RENAME: Used to rename an object existing in the database.
DATABASE MANAGEMENT SYSTEM

To create table in database.

Syntax:

CREATE TABLE TableName (


column1 datatype,
column2 datatype,
...
);

Example:
CREATE TABLE Student (
s_id INT,
s_name VARCHAR(100)
);
DATABASE MANAGEMENT SYSTEM

DML(Data Manipulation Language)


• DML is used to manipulate data within the database.
• DML statements include SELECT, INSERT, UPDATE, and DELETE
statements.
• It is related to store, display, delete and retrieve of data/records.
• DML statements interact with the data stored in the database tables.
• It helps user to use query and display reports of the table.

List of DML commands:


SELECT: Used to select data from table.
INSERT: Used to insert data into a table.
UPDATE: Used to update existing data within a table.
DELETE: Used to delete records from a database table.
DATABASE MANAGEMENT SYSTEM

To insert records into a table student.

Syntax:

INSERT into tableName (column1, column2, ...)


VALUES (value1, value2, ...);

Example:

INSERT into Student (s_id, s_name)


VALUES (15, ‘rajesh hamal);
DATABASE MANAGEMENT SYSTEM

DCL(Data Control Language):

It includes commands such as GRANT and REVOKE which mainly deal with
the rights, permissions, and other controls of the database system.

List of DCL commands:

GRANT: This command gives users access privileges to the database.


REVOKE: This command withdraws the user’s access privileges given by using
the GRANT command.
KEY IN DATABASE:
Keys

• It is an attribute that is used to uniquely identify any record or


row of data from the table.
• It is also used to establish and identify relationships between
tables.

Primary key

• It is a column in a table that uniquely identify every row in


that table.
• A table cannot have more than one primary bkey.
• Primary key can’t be duplicate which means the same value
can’t appear more than once.

• In the EMPLOYEE table, ID can be the primary key since it is


unique for each employee. In the EMPLOYEE table, we can
even select License_Number and Passport_Number as primary
keys since they are also unique.
Foreign key

• It is a column that create a relationship between two


tables.
• Foreign keys are the column of the table used to point to
the primary key of another table.
• The purpose of foreign key is to maintain data integrity.
• It acts as a cross-reference between two tables as it
references the primary key of another table.
• In the EMPLOYEE table, Department_Id is the foreign
key as it is primary key of another table, and both the
tables are related.
Candidate key
• A candidate key is an attribute or set of
attributes that can uniquely identify a tuple.
• Except for the primary key, the remaining
attributes are considered a candidate key.
• The candidate keys are as strong as the primary
key.
• The primary key should be selected from the
candidate key.
• Every table must have at least a single
candidate key.
• For example: In the EMPLOYEE table, id is best
suited for the primary key. The rest of the
attributes, like SSN, Passport_Number,
License_Number, etc., are considered a
candidate key.
Alternate key

• Alternate key is a column or group of columns in a table that


uniquely identify every row in that table.
• A table can have multiple choice for primary key but only one
can be set as primary key.
• All the keys which are not primary key are called alternate key.
• In other words, the total number of the alternate keys is the
total number of candidate keys minus the primary key.
• For example, employee relation has two attributes,
Employee_Id and PAN_No, that act as candidate keys. In this
relation, Employee_Id is chosen as the primary key, so the
other candidate key, PAN_No, acts as the Alternate key.
DATABASE MODEL

• A set of rules and standards that define how the database organizes data is
called database model.
• It shows the logical structure of a database including the relationships, data
types structure of tables.
• It provide us with a transparent picture of data which helps us in creating an
actual database.

Types of database models:

• Hierarchical Database Model


• Network Database Model
• Relational Database Model
DATABASE MODEL

Hierarchical Database Model:

• Hierarchical database model is one of the oldest type


database models.
• In this model data is represented in the form of records.
• Each record has multiple fields/ attributes. All records
are arranged in database as tree like structure.
• The relationship between the records is called parent
child relationship in which any child record relates to
only a single Parent type record.
• There is only one parent node for each child node
(although the parent node can have multiple children).
• An entity type can be either a parent or a child.
Hierarchical Database Model
Hierarchical Database Model

Advantage:

• Easiest model and faster data accessing speed.


• Searching is fast and easy, if parent is known.
• It supports one to one and one to many relationship.

Disadvantages:

• Old fashioned, outdated database model


• Does not support many to many relationship
• Dependency on parent node is not beneficial always.
• It increases redundancy because same data is to be
repeated in different places.
Network Database Model :

• The network database model is a type of database model


where multiple member records or files can be linked to
multiple files and vice versa.
• It replaced hierarchical database model due to some
limitations on the model.
• The structure of database is more like graph rather than
tree structure.
• It consists of collection of records which are inter-
related to each other with the help of relationship.
• It allows each child to have multiple parents.
• The records can be accessed from more than one
parent.
Network Database Model

Advantages:

• It accepts many-to-many relationship, so it is more flexible.


• The searching is faster because of multidirectional pointers.
• The network model is simple and easy to design.
• It reduces redundancy because data shouldn't be repeated if same
data is needed.

Disadvantages:

• It is difficult to handle the relationship in complex programs.


• There is less security because of sharing data.
• It increases the processing overhead due to the complex relationship.
• Data insertion and deletion operations require large number of
adjustments.
Relational Database Model

Relational Database Model


● It is collective set of multiple data sets organized by tables, records
and columns.
● It establish a well defined relationship between database tables.
● The data is organized into tables which contain multiple rows and
columns.
● These tables are called relations.
● A row in a table represents a relationship among a set of values.
● The database system which stores and display data in tabular
format of rows and column like spreadsheet is known as Relational
Database Management System.(RDMS)
● Example of RDBMS are Oracle,SQL,MS-Access ,MySQL etc
Advantages and Disadvantage of Relational database
model:

Advantages:
● Breaking of complex database table into simple database table
becomes possible .
● Database processing is faster than other model.
● There is very less redundancy (repetition of data).
● It maintains data integrity.

Disadvantages:
● It is more complex than others models.
● There are too many rules because of complex relationship.
● It needs more powerful computers and data storage devices.
● Cost is high for hardware and softwares.
Normalization of Data
What is Normalization?:

Normalization is the process of decomposing a big table into many


smaller tables to reduce data redundancy and to ensure data
dependencies.
• Normalization is used to minimize the redundancy from a relation or
set of relations and maintains data integrity and consistency.
• it helps to avoid certain undesirable characteristics like:insertion,
deletion and updation anomalies.

Why do we need Normalization?


The main reason for normalizing the relations is removing these
anomalies. Failure to eliminate anomalies leads to data redundancy and
can cause data integrity and other problems as the database grows.
Normalization consists of a series of guidelines that helps to guide you in
creating a good database structure.
The main goal of normalization is to eliminate data redundancy and identify
data dependency.

Benefits of Normalization:
● Minimize data redundancy.
● dependency between data field is identified.
● maintains data consistency and data integrity.
● improves database performance.
● simplifies the structure of tables.
● avoids the loss of information.
Normalization Process:

Let us consider the following Library table as the reference table.

S_ID Name Book_ID Book_Name Issue_Date Return_Date

NSS100 Sabin Bagale CS200 Computer Science 15/01/2024 22/01/2024

NSS101 Ganesh Bhatta CS201 Computer Science 01/01/2024 07/01/2024

NSS102 Ram Oli , Sri Oli CS202, CS203 Computer Science 15/01/2024 22/01/2024

Normal forms are used to ensure that various types of anomalies and
inconsistencies are removed from the database.
First-Normal form(1-NF)
• A relation will be 1NF if it contains an atomic attribute/field
name.
• Every column in the table must be uniquely named.
• It states that an attribute of a table can not hold multiple values
in a record which means it must hold only single-value.
• It eliminates duplicate rows and columns from the same table.

S_ID First Name Last Name Book_ID Book_Name Issue_Date Return_Date

NSS100 Sabin Bagale CS200 Computer Science 15/01/2024 22/01/2024

NSS101 Ganesh Bhatta CS201 Computer Science 01/01/2024 07/01/2024

NSS102 Ram Oli CS202 Computer Science 15/01/2024 22/01/2024

Now the given relation is in 1NF.


Third Normal Form(3NF)
• A relation will be 3NF if the table is in 2NF.
• Every non-key attributes is functionally dependent only on the primary key.
• It removes the transitive dependencies in a table.

Transitive dependency means: if A,B and C is attributes in a relation R &


A -> B, B -> C then we can derive A -> C using functional dependency.

Let us consider the following Student, Class and Subject tables as the reference
table which is in 2NF.
S_ID First Last C_ID C_ID Class Class Book_Name
Name Name
NSS100 Sabin Bagale C10 C10 10 10 Computer Science

NSS101 Ganesh Bhatta C11 C11 11 11 Chemistry

NSS102 Ram Oli C12 C12 12 12 Physics


In order to decompose in 3NF, we have to identify the dependencies in the relation.
S_ID -> First Name, Last Name, C_ID
C_ID -> Class
Class -> Book_Name

After removing transitive dependencies, the following table is in 3NF.

S_ID First Name Last Name Book_Name

NSS100 Sabin Bagale Computer


Science
NSS101 Ganesh Bhatta Chemistry

NSS102 Ram Oli Physics


Database security

Database security refers to the measures taken to protect databases and


the data stored within them from unauthorized access, data corruption, and
other threats. It involves various strategies, technologies, and practices to
ensure the confidentiality, integrity, and availability of data.

Here are some key aspects of database security:

Access Control: Controlling who can access the database and what
actions they can perform. This involves user authentication (verifying users'
identities) and authorization (determining what actions users are allowed to
perform).

Encryption: Protecting data by encoding it using cryptographic techniques,


so that even if unauthorized users gain access to the data, they cannot
read it without the decryption key.
Backup and Recovery: Regularly backing up databases
and having a robust plan for recovering data in case of
accidental deletion, corruption, or other incidents.

Authentication:it is the process of verifying the identity of


a user or system trying to access a resource. It ensures
that the user is who they claim to be before granting
access. It involves verifying credentials such as usernames
and passwords, biometric data (like fingerprints), security
tokens, smart cards or digital certificates.
Authorization:It is the process of determining whether a
user or system has the necessary permissions to access a
particular resource or perform a specific action within the
system.It follows authentication and ensures that
authenticated users only have access to the resources and
data they are allowed to use based on their permissions
and roles.
Auditing and Monitoring: Logging database activities and
monitoring them in real-time to detect suspicious activities
or unauthorized access attempts.

You might also like