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

DBMS

Banking DBMS detailed notes.

Uploaded by

Just like Mars
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

DBMS

Banking DBMS detailed notes.

Uploaded by

Just like Mars
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

AIM 2.

0 Date: 25-02-2024

Database Management System by Abhishek Sachan Sir


Data: Information that is stored and used by computers, like numbers, words, images, or
sounds.
Database: A structured collection of data organized in a way that makes it easy to access,
manage, and update.
Database Management: The process of efficiently organizing, storing, and retrieving data in
a database system.
System: A group of interconnected parts working together to achieve a specific goal or
function, like a computer system or a transportation system.

What is DBMS?
A Database Management System (DBMS) is software designed to efficiently store, retrieve,
and manage large volumes of data in a structured manner. It provides users with an interface
to interact with the database, allowing them to input, update, and extract information as
needed. DBMS ensures data integrity, security, and reliability while facilitating data
organization and manipulation for various applications and users.

Key Terms
Entity: An object or concept with a distinct identity that is represented in the database.
Examples include a person, place, thing, or event, such as a customer, product, or order.
Attributes: Characteristics or properties that describe an entity and provide details about it.
Each entity has attributes that define its specific qualities or features. For instance, attributes
of a customer entity might include name, address, email, and phone number.
Table: A structured arrangement of data organized into rows and columns. Tables are used to
store information in a relational database management system (RDBMS). Each table typically
represents a specific entity or concept, with rows representing individual instances (records)
and columns representing attributes (fields) of those instances.
Field: Also known as a column or attribute, a field is a specific piece of data stored within a
table. Each field corresponds to a particular characteristic or property of the entities
represented by the table. For example, in a table representing "Customers," fields might
include "Customer ID," "Name," "Email," and "Address."
Record: Also known as a row or tuple, a record is a complete set of related data within a
table. It represents a single instance or occurrence of the entity being described by the table.
Each record consists of a collection of values, with each value corresponding to a specific
field or attribute of the entity. For instance, in a table of "Employees," each record might
contain information such as the employee's ID, name, department, and salary.

pg. 1
AIM 2.0 Date: 25-02-2024

What is a record?
A record is a collection of related data fields (or attributes) that represent a single instance of
an entity in a database. It's like a row in a table, where each column represents a different
attribute of the entity, and each row represents a specific occurrence or instance of that entity.
For example, in a database table of "Customers," each record would represent a unique
customer, with each field within the record providing details about that customer, such as
their name, address, and phone number.

What is the difference between data and Information?


Data refers to raw facts, figures, or symbols that represent something but do not necessarily
carry any specific meaning on their own.
Information is the result of organizing, analyzing, and interpreting data to give it context,
relevance, and meaning.
Data is like individual puzzle pieces, while information is the completed puzzle that emerges
when those pieces are put together in a meaningful way.

Table (Relation): Table is a collection of rows and Columns.


Some Example of Database Software: FoxPro, MS-Access, Oracle Db, SQL Server,
MySQL, DB2, Db6, Sybase, etc.

Note:
1. Database always exists in ‘Backend’.
2. Backend always dealt by ‘DBA (Database Administrator’.
3. DBA has all type of privileges to make any kind of changes in Database.
4. End user always interacts with ‘Frontend’.
5. Frontend also called as ‘User Interface’.
6. End user has those privileges which as provided by DBA.

Note:
1. Smallest unit of data storage: bit
2. Smallest unit of data which can be entered by user in computer: Byte
3. Table is a collection of rows and columns.
4. Cell is an intersection of row and column.
5. Smallest data entered by user: Character.
6. Bit  Byte  Character  Field  Record  File  Database.
Or
Character  Field  Record  File  Database.

pg. 2
AIM 2.0 Date: 25-02-2024

Database Operations
Database operations refer to the actions performed on a database to manage, manipulate, and
retrieve data. Some common database operations include:
1. Insert: Adding new data records or rows into a database table.
2. Select: Retrieving data records or rows from a database table based on specified criteria.
3. Update: Modifying existing data records in a database table.
4. Delete: Removing data records or rows from a database table.
5. Create: Creating new database objects such as tables, indexes, or views.
6. Drop: Deleting or removing existing database objects from the database schema.
7. Alter: Modifying the structure of an existing database object, such as adding or
removing columns from a table.

These operations are fundamental to managing and maintaining data integrity, consistency,
and usability within a database system.

DBA (Database Administrator): A DBA, or Database Administrator, is a person or a team


responsible for managing, configuring, and maintaining a database management system
(DBMS) to ensure its smooth operation. Their responsibilities typically include database
design, installation, security implementation, performance monitoring, backup and recovery,
and user management.
DBAs play a critical role in ensuring data integrity, security, and availability within an
organization's database environment.

Schema: A schema refers to the logical structure or blueprint that defines the organization,
relationships, and constraints of the data stored in a database. It represents the overall design
and layout of the database, including tables, fields, data types, relationships, and integrity
constraints such as primary keys, foreign keys, and unique constraints.
A schema provides a framework for organizing and accessing data, ensuring consistency and
coherence in data representation and manipulation within the database system.

Instance: An instance refers to a particular occurrence or version of a database system that is


running and accessible for use. It includes all the data stored within the database at a specific
point in time, as well as the associated database management system (DBMS) processes and
resources. Each instance operates independently and can have its own configurations,
security settings, and performance parameters.

pg. 3
AIM 2.0 Date: 25-02-2024

Queries: Queries are commands or requests made to a database management system


(DBMS) to retrieve, manipulate, or manage data stored in a database. They are used to
perform operations such as selecting specific data records, updating existing records,
inserting new records, or deleting records based on specified criteria. Queries are typically
written in a structured query language (SQL) and can range from simple to complex,
depending on the requirements of the task.

Here are some examples of database queries using SQL (Structured Query Language):
1. Select Query: Retrieve all columns from a table named "Customers":
SELECT * FROM Customers;

2. Filtering: Retrieve specific columns and filter results based on a condition (e.g., only
customers from a certain city):
SELECT CustomerName, City FROM Customers WHERE City = 'New York';

3. Sorting: Retrieve data in a specific order (e.g., ascending order of customer names):
SELECT * FROM Customers ORDER BY CustomerName ASC;

4. Joining Tables: Retrieve data from multiple tables by joining them based on a common
attribute (e.g., retrieving customer names and their corresponding orders):
SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID;

5. Aggregation: Perform aggregate functions such as counting, summing, or averaging data


(e.g., counting the number of orders for each customer):
SELECT CustomerID, COUNT(OrderID) AS OrderCount
FROM Orders
GROUP BY CustomerID;

6. Inserting Data: Add new records to a table (e.g., adding a new customer):
INSERT INTO Customers (CustomerName, City) VALUES ('John Doe', 'Los Angeles');

pg. 4
AIM 2.0 Date: 25-02-2024

7. Updating Data: Modify existing records in a table (e.g., updating the city for a specific
customer):
UPDATE Customers SET City = 'Chicago' WHERE CustomerName = 'John Doe';

8. Deleting Data: Remove records from a table (e.g., deleting a customer):


DELETE FROM Customers WHERE CustomerName = 'John Doe';

Keys: In a database context, keys are attributes or combinations of attributes that uniquely
identify records within a table. They help enforce data integrity and establish relationships
between tables in a relational database. Common types of keys include:
a. Primary Key: A unique identifier for each record in a table, ensuring that each row
has a distinct identity.

In any database/ table Primary Key must be “NOT NULL”.

In ay table only one primary key is possible.

Example: Roll no., A/c no, Enrolment no, etc.

b. Foreign Key: A field or combination of fields in one table that refers to the primary
key in another table, establishing a relationship between the two tables.
Foreign Key is a Referential Constraints between two or more tables.
A field which works as a primary key in a table works as a foreign key in another
table.
c. Composite Key: A combination of two or more attributes used together as a unique
identifier for a record.
d. Candidate Key: An attribute or combination of attributes that could potentially serve
as a primary key.
Those fields which re responsible/ eligible to work as a Primary Key.
Primary key is a subset of Candidate key.
e. Minimal Super Key: A minimal super key is the smallest set of attributes within a
relation (table) that uniquely identifies each tuple (row) in that relation. In other
words, it is the smallest combination of attributes that can function as a candidate key,
satisfying the requirement that no subset of the super key is also a key.

pg. 5
AIM 2.0 Date: 25-02-2024

For example, in a relation with attributes {A, B, C}, if {A, B} and {B, C} are both
candidate keys, then {A, B} is a minimal superkey because it is the smallest
combination of attributes that uniquely identifies each tuple, and removing either
attribute would result in a non-unique identifier. However, {A}, {B}, {C}, and {A, B,
C} are not minimal superkeys because they contain unnecessary attributes or subsets
that can also uniquely identify tuples.
f. Unique Key: Similar to a primary key but allows null values and can have multiple
instances within a table.

Those fields which are responsible/ eligible to work as a Primary Kay, but currently
having “NULL”.

Unique Key = Primary Key + NULL

Primary Key = Unique Key – NULL

Note: Difference between NULL and Zero. Null is blank Space, zero is a value.

g. Alternate Key: Those fields which are responsible to work as a Primary key, except
Primary Key.
Example: In a student table Registration number and Email ID both can be used to
uniquely identify a student. If Registration number is Primary Key, then Email ID can
be called as Alternate Key and Vice versa.

Database Language

There are mainly five types of database languages:

1. Data Definition Language (DDL):


a. DDL is used to define the structure and schema of a database.
b. It includes commands like CREATE, ALTER, DROP, and TRUNCATE to create,
modify, and delete database objects such as tables, indexes, views, and schemas.
c. DDL statements are used to specify the data types, constraints, and relationships
among data elements.

pg. 6
AIM 2.0 Date: 25-02-2024

2. Data Manipulation Language (DML):


a. DML is used to manipulate and query data within the database.
b. It includes commands like SELECT, INSERT, UPDATE, and DELETE to
retrieve, add, modify, and delete data records.
c. DML statements are used to perform various operations such as filtering, sorting,
grouping, and aggregating data.

3. Data Control Language (DCL):


a. DCL is used to control access to the database and manage user privileges.
b. It includes commands like GRANT and REVOKE to grant or revoke permissions
on database objects to users or roles.
c. DCL statements are used to enforce security policies and regulate user access to
data.

In addition to these, there are also Data Query Language (DQL) and Transaction Control
Language (TCL), which are subsets of DML and DCL, respectively.

4. Data Query Language (DQL):


a. DQL is used specifically for querying data from the database.
b. It primarily consists of SELECT statements.

5. Transaction Control Language (TCL):


a. TCL is used to manage transactions within the database.
b. It includes commands like COMMIT, ROLLBACK, and SAVEPOINT to manage
the transactional behavior of database operations.

pg. 7

You might also like