Nep dbms-1
Nep dbms-1
DATBASE
MANAGEMENT
SYSTEM
Introduction
• Data: It is the unorganised facts which need to be
compiled to form meaningful information
• Information: Once the data is processed and made
into a structured context, it is called information.
• Database :
A database is a collection of organized data which
can easily be created, updated, accessed, and
managed. Records are kept maintained in tables or
objects. A tuple (row) represents a single entry in a
table. DBMS manipulates data from the database in
the form of queries given by the user.
DBMS stands for Database Management
System. We can break it like this DBMS =
Database + Management System.
Database is a collection of data and
Management System is a set of programs
to store and retrieve those data.
Based on this we can define DBMS like
this: DBMS is a collection of inter-related
data and set of programs to store & access
those data in an easy and effective manner.
Definition of DBMS
Update
• The Update command is used for update
information In the Table.
• Now I will update name John Doe to Roman in
the ClassMemebers Table.
• Below I provide that Example you can update
any row or columns data.
Syntax:
• UPDATE Table_Name SET Name = 'New_Value'
WHERE Name = 'Ola_Value';
• Example:
Delete:
• The Delete command is used for delete data from
the Table. Here I delete Student Id with 2 from the
ClassMembers. Below I provide the Example for
your reference.
Syntax:
• DELETE FROM Table_Name WHERE Column =
Value;
Example:
Merge
• The Merge command is used for perform upsert
operation means It inserts rows that doesn’t exist and
updates rows that do.
Example:
MERGE INTO target_table AS target
USING source_table AS source
ON (target.id = source.id)
WHEN MATCHED THEN
UPDATE SET target.name = source.name
WHEN NOT MATCHED THEN
INSERT (id, name) VALUES (source.id,
source.name);
CALL
• The Call command is used for call the user defined
functions
Example:
CALL user_defined_function(parameter 1, parameter 2);
LOCK TABLE
• The lock table command is used for lock the table for
preventing access from the others for same Table
Syntax:
• LOCK TABLE your_table IN EXCLUSIVE MODE;
Example:
• LOCK TABLE ClassMembers IN EXCLUSIVE
MODE;
TCL ( Transaction Control Language )
• The TCL full form is Transaction Control Language
commands are used to run the changes made by the DML
commands And one more thing is TCL can be grouped into
a logical transaction.
• And We have two different commands in this category
below I listed them for reference.
Commit
It is used for save the transaction on the Database.
• And these very useful in banking sectors.
Rollback
• It is used for restore the database to original state from last
commit.
• This command also plays an important role in Banking
Sectors.
Commit
• The Commit command is used for save the
transaction in the database and changes are made
by the DML statements.
• Now I will provide the example below Here I used
ClassMembers Table.
• Here I inserted a new data into Table then I
commit It.
Syntax:
• Database Operation
Commit
Example:
ROLLBACK
• Rollback command is used for restore the database
to original state from last commit.
• Now I delete one row from the Table then again
rollback the previous database state.
Syntax:
• ROLLBACK;
Example:
DQL (Data Query Language)
• DQL statements are used for performing queries on
the data within schema objects.
• The purpose of the DQL Command is to get some
schema relation based on the query passed to it.
• We can define DQL as follows it is a component of
SQL statement that allows getting data from the
database and imposing order upon it.
• It includes the SELECT statement.
• This command allows getting the data out of the
database to perform operations with it.
List of DQL:
• SELECT: It is used to retrieve data from the database.
Interfaces
• An interface is a program that allows users to input queries
into a database without writing the code in the query
language.
• An interface can be used to manipulate the database for
adding, deleting, updating, or viewing the data.
Command-Line Interface (CLI)
• The earliest and most fundamental form of DBMS
interface is the command-line interface (CLI).
• Through the use of a command prompt, users may
communicate with the database by inputting
commands.
• Users can only access and modify the database
using particular commands and syntax.
• Today, programmers and database administrators
are the main users of CLI.
Graphical User Interface (GUI)
• The most prevalent kind of DBMS interface used
nowadays is the graphical user interface (GUI).
• Users may interact with the database using the user-
friendly interface's graphical menus and icons.
• GUIs are user-friendly and need little to no
programming experience.
• They are mostly utilized by non-programmers who are
end users.
Example
• You liked a video on Instagram by tapping with your
finger, and the color changes to red.
• The visual graphic gets changed due to user action.
Web-Based Interface
• Users can access the database using a browser
using the web-based interface.
• Users can use online forms, buttons, and other
graphical components to interact with the database
using a web browser.
• Because they can be accessed from any location
with an internet connection, web-based interfaces
are common.
Natural language interface
• contains its unique schema more like the high−level
conceptual schema.
• It also has a directory of important words.
• It generates a query based on the interpretation of
important words in the input by the user and if the
interpretation is successful, then it displays the result
to the user.
Example
• A user googled the fastest car in India, and now the
natural language interface will look for the important
words i. e. fastest, car, India, and show the result
accordingly.
Forms-Based Interface
• Using the forms-based interface, users may enter
data into the database using a graphical user
interface.
• Users can complete pre-made forms that provide
fields for particular categories of information, such
as name, address, and phone number.
• Applications for data entry frequently employ
forms-based interfaces.
Example
• Student entering his roll. no, branch in the form to
get the grade card.
Menu-Based Interface
• Users have access to a number of predefined
menus and choices when using the menu-based
interface to interact with the database.
• Users can choose the menu choice that reflects the
intended action, such as adding or removing data,
from the available options.
• The user doesn’t need to memorize the command
and syntax and the query is composed step by step
by picking options from a menu.
Database System Environment or
Components of DBMS Environment
The term database system refers to an organization
of components that define and regulate the
collection, storage, management, and use of data
within a database environment.
These are:
• Hardware
• Software
• People
• Procedures
• Data
1] Hardware-
• It identifies all the system’s physical devices.
1].Centralized systems
• With a centralized database system, the DBMS
and database are stored at a single site that is used
by several other systems too.
• This is illustrated in following Figure.
Example of a centralized database system.
1 Avi 19 M
2 Ayush 23 M
3 Nikhil 21 M
4 Riya 16 F
1 Avi 19 M
Entity Type :
Each entity belongs to the student type. Hence, the
type of entity here is a student.
Entity Set :
The complete data set of all entities is called entity
set. For the above table, the records with student id
1, 2, 3, 4 are the entity set.
Difference Table :
Entity Entity Type Entity Set
A thing in the real world with A category of a particular Set of all entities of a
independent existence entity particular entity type.
Candidate Key
Primary Key
Alternate Key
Unique Key
Foreign Key
Composite Key
Patients Table
Patient ID Patient Name Sex Age MedInsuranceNo AadharNo
01 Sheela F 23 Med0291 839292319012
02 Rehan M 21 Med8421 123456789012
03 Anay M 56 Med4203 848298469201
04 Mahira F 42 Med4792 724723021922
05 Nishant M 12 Med8419 47203831109
03 Anay M 56 Med4203 848298469201