DBMS
DBMS
0 Date: 25-02-2024
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.
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.
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.
pg. 3
AIM 2.0 Date: 25-02-2024
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;
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';
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.
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”.
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
pg. 6
AIM 2.0 Date: 25-02-2024
In addition to these, there are also Data Query Language (DQL) and Transaction Control
Language (TCL), which are subsets of DML and DCL, respectively.
pg. 7