0% found this document useful (0 votes)
18 views26 pages

DBMS NOTES (Module4)

Uploaded by

Surivkl Vkl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
18 views26 pages

DBMS NOTES (Module4)

Uploaded by

Surivkl Vkl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 26

I MCOM INFORMATION SYSTEMS AND COMPUTER

DATABASE MANAGEMENT SYSTEMS.

What is a database?

A database is information that is set up for easy access, management and


updating. Computer databases typically store aggregations of data records or files
that contain information, such as sales transactions, customer data, financials and
product information.

Types of Databases
There are various types of databases used for storing different varieties of data:

1) Centralized Database

 It is the type of database that stores data at a centralized database system.


 It comforts the users to access the stored data from different locations
through several applications.
 These applications contain the authentication process to let users access
data securely.
 An example of a Centralized database can be Central Library that carries a
central database of each library in a college/university.

DATABASE MANAGEMENT SYSTEMS Page 1


I MCOM INFORMATION SYSTEMS AND COMPUTER

Advantages of Centralized Database

 It has decreased the risk of data management, i.e., manipulation of data will
not affect the core data.
 Data consistency is maintained as it manages data in a central repository.
 It provides better data quality, which enables organizations to establish data
standards.
 It is less costly because fewer vendors are required to handle the data sets.

Disadvantages of Centralized Database

 The size of the centralized database is large, which increases the response
time for fetching the data.
 It is not easy to update such an extensive database system.
 If any server failure occurs, entire data will be lost, which could be a huge
loss.

2) Distributed Database

 A centralized database system, in distributed systems, data is


distributed among different database systems of an organization.

DATABASE MANAGEMENT SYSTEMS Page 2


I MCOM INFORMATION SYSTEMS AND COMPUTER

 These database systems are connected via communication links. Such


links help the end-users to access the data easily.
 Examples of the Distributed database are Apache Cassandra, HBase,
Ignite, etc.

Advantages of Distributed Database

 Modular development is possible in a distributed database, i.e., the system


can be expanded by including new computers and connecting them to the
distributed system.
 One server failure will not affect the entire data set.

3) Relational Database

 This database is based on the relational data model, which stores data
in the form of rows(tuple) and columns(attributes), and together forms
a table(relation).
 A relational database uses SQL for storing, manipulating, as well as
maintaining the data. E.F. Codd invented the database in 1970.
 Each table in the database carries a key that makes the data unique
from others. Examples of Relational databases are MySQL, Microsoft
SQL Server, Oracle, etc.

4) NoSQL Database

 Non-SQL/Not Only SQL is a type of database that is used for storing


a wide range of data sets.
 It is not a relational database as it stores data not only in tabular form
but in several different ways.

DATABASE MANAGEMENT SYSTEMS Page 3


I MCOM INFORMATION SYSTEMS AND COMPUTER

 It came into existence when the demand for building modern


applications increased.

Advantages of NoSQL Database

 It enables good productivity in the application development as it is not


required to store data in a structured format.
 It is a better option for managing and handling large data sets.
 It provides high scalability.
 Users can quickly access data from the database through key-value.

5) Cloud Database

 A type of database where data is stored in a virtual environment and


executes over the cloud computing platform.
 It provides users with various cloud computing services (SaaS, PaaS,
IaaS, etc.) for accessing the database.

There are numerous cloud platforms, but the best options are:

 Amazon Web Services(AWS)


 Microsoft Azure
 Kamatera
 PhonixNAP
 ScienceSoft
 Google Cloud SQL, etc.

DATABASE MANAGEMENT SYSTEMS Page 4


I MCOM INFORMATION SYSTEMS AND COMPUTER

6) Object-oriented Databases

 The type of database that uses the object-based data model approach
for storing data in the database system.
 The data is represented and stored as objects which are similar to the
objects used in the object-oriented programming language.

7) Hierarchical Databases

 It is the type of database that stores data in the form of parent-children


relationship nodes. Here, it organizes data in a tree-like structure.
 Data get stored in the form of records that are connected via links.
Each child record in the tree will contain only one parent. On the other
hand, each parent record can have multiple child records.

8) Network Databases

 It is the database that typically follows the network data model.


 Here, the representation of data is in the form of nodes connected via
links between them.
 it allows each record to have multiple children and parent nodes to
form a generalized graph structure.

9) Personal Database

Collecting and storing data on the user's system defines a Personal Database.
This database is basically designed for a single user.

Advantage of Personal Database

 It is simple and easy to handle.


 It occupies less storage space as it is small in size.

DATABASE MANAGEMENT SYSTEMS Page 5


I MCOM INFORMATION SYSTEMS AND COMPUTER

10) Operational Database

 The type of database which creates and updates the database in real-
time. It is basically designed for executing and handling the daily data
operations in several businesses.
 For example, An organization uses operational databases for
managing per day transactions.

11) Enterprise Database

 Large organizations or enterprises use this database for managing a


massive amount of data.
 It helps organizations to increase and improve their efficiency. Such a
database allows simultaneous access to users.

Advantages of Enterprise Database:

 Multi processes are supportable over the Enterprise database.


 It allows executing parallel queries on the system.

FIELDS:

Fields are the components that provide structure for a table. fields
defined but no rows (records). In databases, fields are used to maintain
relationships between tables.

Here storename,store address storecity etc are the fields.

DATABASE MANAGEMENT SYSTEMS Page 6


I MCOM INFORMATION SYSTEMS AND COMPUTER

Records:

The term record in DBMS refers to a collection of items or data organized


within a table within a set of fields related to a particular topic or theme.

Table:

Tables are database objects that contain all the data in a database. In
tables, data is logically organized in a row-and-column format similar to a
spreadsheet. Each row represents a unique record, and each column represents a
field in the record

DATABASE MANAGEMENT SYSTEMS Page 7


I MCOM INFORMATION SYSTEMS AND COMPUTER

DATABASE USERS:

End Users

End users are the people whose jobs require access to a database for
querying, updating and generating reports.

Application user

The application user is someone who accesses an existing application


program to perform daily tasks.

Sophisticated user

 Sophisticated users are those who have their own way of accessing the
database.
 This means they do not use the application program provided in the
system. Instead, they might define their own application or describe
their need directly by using query languages.

Application Programmers

These users implement specific application programs to access the stored


data. They must be familiar with the DBMSs to accomplish their task.

Database Administrators (DBA)

This may be one person or a group of people in an organization responsible


for authorizing access to the database, monitoring its use and managing all of the
resources to support the use of the entire database system.

DATABASE MANAGEMENT SYSTEMS Page 8


I MCOM INFORMATION SYSTEMS AND COMPUTER

INSTANCE OF DATABASE.

The situation where a data or information is stored in the database


at a particular moment of time is called an instance. An instance is also called a
current state or database state.

Schema
A database schema is a structure that represents the logical storage of
the data in a database. It represents the organization of data and provides
information about the relationshipsbetween the tables in a given database

Data

Data is the raw material that can be processed for any computing machine.

For example − Employee name, Product name, Name of the student, Marks of the
student, Mobile number, Image etc.

Database Management System (DBMS) Mean?

A database management system (DBMS) is a software package designed to


store, retrieve, query and manage data.

Application areas of DBMS.


 Railway Reservation System – ...
 Library Management System – ...
 Banking – ...
 Education Sector – ...
 Credit card exchanges – ...
 Social Media Sites – ...
 Broadcast communications – ...
 Account –

DATABASE MANAGEMENT SYSTEMS Page 9


I MCOM INFORMATION SYSTEMS AND COMPUTER

Packages of dbms/softwares in dbms/sql

 Microsoft Access. Microsoft's DBMS, known as Access, combines a


graphical user interface, software development tools, and the relational
Microsoft Jet Database Engine.
 MySQL. ...
 Oracle Database. ...
 MongoDB. ...
 IBM Db2 DBMS. ...
 Amazon RDS. ...
 PostgreSQL. ...
 Apache Cassandra.

Objectives of DBMS

1. To Reduce Duplication

. Recent DBMS will automatically check the duplicate record and


give warning to you for not recording.

2.To Share the Data : To share the data to its users under the controlled
environment is the objective of DBMS.

For example, we all use Google Drive. Actually, it has been renamed of
Google's old Google Docs.google docs application is also DBMS.

3. To Bring Integrity of Data

Integrity of data means to bring the accuracy and consistency. For this,
DBMS gives power toits user that they can establish the validation controls.

DATABASE MANAGEMENT SYSTEMS Page 10


I MCOM INFORMATION SYSTEMS AND COMPUTER

4. To Secure the Data :Data of any organisation is the worthy asset. It should be
protected. For security of the data is the responsibility of data administrator.

5. To Bring Independence in Data


Data should be independent both physical and logical. In database fields any
record should easily add or delete

Data Model

Data Model gives us an idea that how the final system will look like after its
complete implementation

Some of the Data Models in DBMS are:

1. Hierarchical Model
2. Network Model
3. Entity-Relationship Model
4. Relational Model
5. Object-Oriented Data Model

Hierarchical Model
 Hierarchical Model was the first DBMS model. This model
organises the data in the hierarchical tree structure.

 The hierarchy starts from the root which has root data and then
it expands in the form of a tree adding child node to the parent
node.

DATABASE MANAGEMENT SYSTEMS Page 11


I MCOM INFORMATION SYSTEMS AND COMPUTER

Features of a Hierarchical Model

One-to-many relationship:

Parent-Child Relationship

Deletion Problem:

Pointers:

Advantages of Hierarchical Model

 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 of Hierarchical Model

 Complex relationships are not supported.

Network Model

 This model is an extension of the hierarchical model.


 It was the most popular model before the relational model.

DATABASE MANAGEMENT SYSTEMS Page 12


I MCOM INFORMATION SYSTEMS AND COMPUTER

 This model is the same as the hierarchical model, the only difference
is that a record can have more than one parent

Advantages of Network Model

 The data can be accessed faster as compared to the hierarchical model.


Disadvantages of Network Model

As more and more relationships need to be handled the system might get Complex.
Entity-Relationship Model

Entity-Relationship Model or simply ER Model is a high-level data model


diagram. In this model, we represent the real-world problem in the pictorial form to
make it easy for the stakeholders to understand.

DATABASE MANAGEMENT SYSTEMS Page 13


I MCOM INFORMATION SYSTEMS AND COMPUTER

Relational Model
Relational Model is the most widely used model. In this model, the data is
maintained in the form of a two-dimensional table. All the information is stored in
the form of row and columns.

Object-Oriented Data Model

The real-world problems are more closely represented through the object-
oriented data model. In this model, both the data and relationship are present in a
single structure known as an object.

DATABASE MANAGEMENT SYSTEMS Page 14


I MCOM INFORMATION SYSTEMS AND COMPUTER

Database views:

User programmers:

a program that must communicate with a resource


manager for some or all of its processing. A user program starts a conversation
with a resource manager to request a connection to a resource.

DATABASE MANAGEMENT SYSTEMS Page 15


I MCOM INFORMATION SYSTEMS AND COMPUTER

An application program (software application, or


application, or app for short) is a computer program designed to carry out a
specific task other than one relating to the operation of the computer itself,
typically to be used by end-users. Word processors, media players, and
accounting software are examples.

A software process is the set of activities and associated outcome that


produce a software product. Software engineers mostly carry out these activities.

Access Software means programs, applications or object code obtained


from Uila and installed in the Customer's environment, including Updates and
Upgrades and for the purposes of facilitating the delivery or functionality of the
Services or On-Premises Software.

A stored database is a repository for persistently storing collections of


data, such as a database, a file system or a directory. In an information technology
context, data stored can be of any type that can be rendered in digital format and
placed in electronic media.

levels of dbms architecture:

DATABASE MANAGEMENT SYSTEMS Page 16


I MCOM INFORMATION SYSTEMS AND COMPUTER

Physical Level
This is the lowest level in the three level architecture. It is also known as the
internal level. The physical level describes how data is actually stored in the
database.

Conceptual Level
The conceptual level is at a higher level than the physical level. It is also
known asthe logical level.

It describes how the database appears to the users conceptually and the
relationships between various data tables.

External Level:
This is the highest level in the three level architecture and closest to the user.
It is also known as the view level.

The external level only shows the relevant database content to the users in
the form of views and hides the rest of the data

File Organization in DBMS

Sequential File Organization


Every file record contains a data field (attribute) to uniquely identify that
record. In sequential file organization, records are placed in the file in some
sequential order based on the unique key field or search key

Direct file organization— organization of files based on a unique for each file,
which is accessed directly through the memory address of the key. Direct file
organization allows data to be retrieved quickly in a random manner.

DATABASE MANAGEMENT SYSTEMS Page 17


I MCOM INFORMATION SYSTEMS AND COMPUTER

Components of DBMS:

A Data Dictionary is a collection of names, definitions, and attributes about


data elements that are being used or captured in a database, information system, or
part of a research project. It describes the meanings and purposes of data elements
within the context of a project, and provides guidance on interpretation, accepted
meanings and representation

Data Mining

Data mining is the process of analyzing a large batch of information to


discern trends and patterns.

Data warehouse

A data warehouse is a central repository of information that can be


analyzed to make more informed decisions. Data flows into a data warehouse
from transactional systems, relational databases, and other sources, typically on a
regular cadence.

Data Mart:

data mart are smaller than data warehouses and generally contain
information from single department of a business or organization.It can be
regarded subset of data warehouse.

Creating and printing formatted reporting in dbms:


1.Formating columns
2.clarifying your reports with spacing and summary lines.
3.Defining page and report titles and dimensions.
4.storing and printing query results

DATABASE MANAGEMENT SYSTEMS Page 18


I MCOM INFORMATION SYSTEMS AND COMPUTER

Formatting Columns
Through the SQL*Plus COLUMN command, you can change the column headings
and reformat the column data in your query results.

Changing Column Headings

When displaying column headings, you can either use the default heading or you
can change it using the COLUMN command. The sections below describe how the
default headings are derived and how you can alter them with the COLUMN
command.

Default Headings
SQL*Plus uses column or expression names as default column headings when
displaying query results. Column names are often short and cryptic, however, and
expressions can be hard to understand.

Changing Default Headings


You can define a more useful column heading with the HEADING clause of the
COLUMN command, in the format shown below:

COLUMN column_name HEADING column_heading

Introduction to SQL

What is SQL?

 SQL stands for Structured Query Language


 SQL lets you access and manipulate databases
 SQL became a standard of the American National Standards Institute
(ANSI) in 1986, and of the International Organization for Standardization
(ISO) in 1987

DATABASE MANAGEMENT SYSTEMS Page 19


I MCOM INFORMATION SYSTEMS AND COMPUTER

What Can SQL do?

 SQL can execute queries against a database


 SQL can retrieve data from a database
 SQL can insert records in a database
 SQL can update records in a database
 SQL can delete records from a database
 SQL can create new databases
 SQL can create new tables in a database
 SQL can create stored procedures in a database
 SQL can create views in a database
 SQL can set permissions on tables, procedures, and views

SQL Data Types/DBMS Datatypes

 Numeric data types such as: INT , TINYINT , BIGINT , FLOAT , REAL
 Date and Time data types such as: DATE , TIME , DATETIME , etc.
 Character and String data types such as: CHAR , VARCHAR , TEXT , etc.
 Unicode character string data types such as: NCHAR , NVARCHAR ,
NTEXT , etc.

SQL Languages
SQL Languages are those languages that allow the database users to read,
modify, delete and store data in the database systems.

Following are the four different types of languages or commands which are widely
used in SQL queries:

DATABASE MANAGEMENT SYSTEMS Page 20


I MCOM INFORMATION SYSTEMS AND COMPUTER

1. TCL (Transaction Control Language)


2. DML (Data Manipulation Language)
3. DCL (Data Control Language)
4. DDL (Data Definition Language)

DDL (Data Definition Language)


Data Definition Languages allow users to create, modify, and destroy the
schema of database objects.

The DDL Languages or commands are categorized into five commands which are
widely used in the SQL queries:

1. CREATE DDL Command


2. ALTER DDL Command
3. DROP DDL Command
4. TRUNCATE DDL Command
5. RENAME DDL Command

Let's discuss each DDL command with syntax and examples.

CREATE Command

This DDL command allows us to create the new table, function, stored
procedure, and other database objects.

Syntax of Create DDL Command to create a new table in the database:

1. CREATE TABLE NameofTable ( Column1 datatype (Length), Column2 dat


atype (Length) …….);

ALTER Command
This DDL command allows us to modify the structure of database objects.

DATABASE MANAGEMENT SYSTEMS Page 21


I MCOM INFORMATION SYSTEMS AND COMPUTER

1. ALTER TABLE NameofTable ADD ColumnName Datatype (Length of Col


umn);
DROP Command
This DDL command allows us to remove the table definition and data from the
SQL systems.
1. DROP TABLE Name_of_Table;

TRUNCATE Command
This DDL command allows the database users to remove all the existing
records from the table.
1. TRUNCATE TABLE Name_of_Table;

RENAME Command
This DDL command allows the users to change the name of the existing table.
1. RENAME Mobile_Details TO Mobile_Records;

DML (Data Manipulation Language)

Data Manipulation languages allow database users to change the existing


data of the tables.

We can use this type of language when we want to access the record, insert the
new record, update the record, and delete the existing values from the tables.

Following are the four DML Languages or commands used in the SQL queries:

1. SELECT DML Command


2. INSERT DML Command
3. UPDATE DML Command
4. DELETE DML Command

DATABASE MANAGEMENT SYSTEMS Page 22


I MCOM INFORMATION SYSTEMS AND COMPUTER

Let's discuss each DML command with syntax and examples.

SELECT Command
This DML command allows us to access the stored records from the tables. We can
also use the condition in the SELECT command for accessing the particular rows.
Syntax of SELECT Command:
1. SELECT * FROM Name_of_Table;
INSERT Command
This DML command allows the database users to insert the new record or
rows in the tables.
Syntax of INSERT Command for inserting the single record:
1. INSERT INTO Name_of_Table ( Column_1, Column_2, Column_3, …..) V
ALUES (Value1_of_Column
UPDATE Command

This DML command allows the database users to change the existing record
or rows in the tables.

Syntax of UPDATE Command for modifying the records:

1. UPDATE NameofTable SET ColumnName = Value WHERE [ Condition ];

DELETE Command

This DML command allows the database users to delete a particular record
or row from the tables.

Syntax of DELETE Command for removing the records:

1. DELETE FROM Name_of_Table WHERE [ condition ];

DATABASE MANAGEMENT SYSTEMS Page 23


I MCOM INFORMATION SYSTEMS AND COMPUTER

DCL (Data Control Language)

Data Control Languages allow DBA to manage the rights and permissions
on the data in the database.

Following are the two DCL Languages or commands used in the SQL queries:

1. Grant DCL Command


2. Revoke DCL Command

Let's discuss the above two DCL commands one by one with syntax and examples.
GRANT Command
This DCL command allows the database administrator to give permissions to the
user for retrieving the data.
Syntax of Grant DCL Command:
1. GRANT Name_of_Privilege ON Object TO User;

REVOKE Command

This DCL command allows the database administrator to remove all the
permissions applied by the GRANT DCL command.

Syntax of REVOKE DCL Command:


1. REVOKE Name_of_Privilege ON Object FROM User;

TCL (Transaction Control Language)


Transaction Control languages maintain the SQL operations within the
database. It also saves the changes made by the DML commands.
Following are the two TCL Languages or commands used in the SQL queries:
1. Commit TCL Command
2. Rollback TCL Command

DATABASE MANAGEMENT SYSTEMS Page 24


I MCOM INFORMATION SYSTEMS AND COMPUTER

Let's discuss the above TCL commands one by one with syntax and examples.

COMMIT Command

This command allows the database users to save the operations in the
database.
Syntax of Commit command:
1. COMMIT;
Rollback Command

This command allows the database users to restore the transactions to that
state which was last committed.

Syntax of Rollback command:

1. ROLLBACK;

The Keys in DBMS/SQL

Primary key:The PRIMARY KEY constraint uniquely identifies each record


in a table. Primary keys must contain UNIQUE values, and cannot contain
NULL values.

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

Trigger:

A database trigger is procedural code that is automatically executed in


response to certain events on a particular table or view in a database.

Sorting Method in DBMS


It is the technique of storing the records in ascending or descending order of
one or more columns. It is useful because, some of the queries will ask us to return
DATABASE MANAGEMENT SYSTEMS Page 25
I MCOM INFORMATION SYSTEMS AND COMPUTER

sorted records, or in operations like joins will be more efficient in sorted records.
All the records are by default sorted based on the primary key column. In addition,
we can specify to sort the records based on other columns, as required.What is a
Database Search?

Database Search in DBMS.


A database search is performed whenever an application wants to extract
specific information from the databaseThis search is usually performed by a driver
that can communicate with the database

TITLE COMMAND IN SQL

To put titles at the top and bottom of each page of a report, enter

SQL> TTITLE CENTER -


> 'ACME WIDGET SALES DEPARTMENT PERSONNEL REPORT'
SQL> BTITLE CENTER 'COMPANY CONFIDENTIAL'

Now run the current query:

SQL> /
SQL*Plus displays the following output:

ACME WIDGET SALES DEPARTMENT PERSONNEL REPORT


DEPTNO ENAME SAL
---------- ---------- ----------
30 JAMES 950
30 WARD 1250
30 MARTIN 1250

COMPANY CONFIDENTIAL
Entity Relationship :

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.

*************************************************************
DATABASE MANAGEMENT SYSTEMS Page 26

You might also like