Professional Documents
Culture Documents
The data stored in database at a particular moment of time is called instance of database. Database
schema defines the variable declarations in tables that belong to a particular database; the value of these
variables at a moment of time is called the instance of that database. A database instance is a state of
operational database with data at any given time. It contains a snapshot of the database. Database
- SyncYourStat 1
2. Database System Concepts and Architecture BCA/BIT 2019 - CITE - DBMS
instances tend to change with time. A DBMS ensures that its every instance (state) is in a valid state,
by diligently following all the validations, constraints, and conditions that the database designers have
imposed. An instance is the
information collected in a database
at some specific moment, and it is
also known as state or extension. It
is a snapshot where the current
state or occurrence of a database is
framed at that moment. Each time
when the data is inserted or deleted
from the database changes the state
of the database that is the reason
why an instance of the database
changes very often.
Data Independence
• Capacity to change the database schema without affecting application programs
• Database contains lot of data + user’s data
• Difficult to modify/update a set of metadata once stored in database
• DBMS don’t have such modification problem
A database system normally contains a lot of data in addition to users’ data. For example, it stores data
about data, known as metadata, to locate and retrieve data easily. It is rather difficult to modify or
update a set of metadata once it is stored in the database. But as a DBMS expands, it needs to change
over time to satisfy the requirements of the users. If the entire data is dependent, it would become a
tedious and highly complex job.
Logical Data Independence
Logical data is data about database, that is, it stores information about how data is managed inside. For
example, a table (relation) stored in the database and all its constraints, applied on that relation.
• Logical data independence refers characteristic of being able to change the conceptual schema
without having to change the external schema.
• Logical data independence is used to separate the external level from the conceptual view.
• If we do any changes in the conceptual view of the data, then the user view of the data would not
be affected.
• Logical data independence occurs at the user interface level.
Logical data independence is a kind of mechanism, which liberalizes itself from actual data stored on
the disk. If we do some changes on table format, it should not change the data residing on the disk.
- SyncYourStat 2
2. Database System Concepts and Architecture BCA/BIT 2019 - CITE - DBMS
For example, in case we want to change or upgrade the storage system itself − suppose we want to
replace hard-disks with SSD − it should not have any impact on the logical data or schemas.
Database Language
A DBMS has appropriate languages and interfaces to express database queries and updates. Database
languages can be used to read, store and update the data in the database.
• Languages that are used to interact with DBMS
• DBMS has appropriate languages and interfaces to express database queries and updates
• Set of statements that are used to define and manipulate database
- SyncYourStat 3
2. Database System Concepts and Architecture BCA/BIT 2019 - CITE - DBMS
• Facilities to define:
o Database Schema
o Table
o Integrity Constraints
o Modify of Schema etc.
• Results of DDL statements are recorded in data dictionary
o CREATE
o DROP
o ALTER
o TRUNCATE
o RENAME
2. Data Manipulation Language (DML)
DML stands for Data Manipulation Language. It is used for accessing and manipulating data in a
database. It handles user requests. Language that provides a set of operations to support basic data
manipulation operations on data held in database
o Language that enables Insert, Delete, Update, Retrieve the data from database
o Query language is only a part of data manipulation language
o Mainly used by end users and programmers
o Facilities to define:
o Retrieval of information
o Update of information
o Supports following DML statements
o INSERT
o DELETE
o UPDATE
o SELECT
- SyncYourStat 4
2. Database System Concepts and Architecture BCA/BIT 2019 - CITE - DBMS
• User specifies what data are required and how to get those data
• Low level data manipulation languages
• E.g. Relational algebra
• Non-Procedural DML
• User specifies what data are needed without specifying how to get those data
• Normally high level manipulation languages
• Eg. SQL
3. Data Control Language
DCL stands for Data Control Language. It is used to retrieve the stored or saved data. The DCL
execution is transactional. It also has rollback parameters.
Here are some tasks that come under DCL:
Grant: It is used to give user access privileges to a database.
Revoke: It is used to take back permissions from the user.
There are the following operations which have the authorization of Revoke:
CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT.
4. Transaction Control Language
TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical
transaction. Here are some tasks that come under TCL:
Commit: It is used to save the transaction on the database.
Rollback: It is used to restore the database to original since the last Commit.
Keys
Keys play an important role in the relational database. It 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. Keys are
very important part of Relational database model. They are used to establish and identify relationships
between tables and also to uniquely identify any record or row of data inside a table. A Key can be a
single attribute or a group of attributes, where the combination may act as a key.
Why we need a Key?
In real world applications, number of tables required for storing the data is huge, and the different tables
are related to each other as well. Also, tables store a lot of data in them. Tables generally extends to
thousands of records stored in them, unsorted and unorganized.
Now to fetch any particular record from such dataset, you will have to apply some conditions, but what
if there is duplicate data present and every time you try to fetch some data by applying certain condition,
- SyncYourStat 5
2. Database System Concepts and Architecture BCA/BIT 2019 - CITE - DBMS
you get the wrong data. How many trials before you get the right data? To avoid all this, Keys are
defined to easily identify any row of data in a table.
Super Key
Super key is an attribute set that can uniquely identify a tuple. A super key is a superset of a candidate
key. The set of attributes that can uniquely identify a tuple is known as Super Key. For Example,
STUD_NO, (STUD_NO, STUD_NAME), etc.
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 minimal set of attributes that can uniquely identify a tuple is known as a
candidate key. For Example, STUD_NO in STUDENT relation.
Primary key
It is the first key used to identify one and only one instance of an entity uniquely. An entity can contain
multiple keys, as we saw in the PERSON table. The key which is most suitable from those lists becomes
a primary key.
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.
For each entity, the primary key selection is based on requirements and developers.
Composite key
Whenever a primary key consists of more than one attribute, it is known as a composite key. This key
is also known as Concatenated Key.
Foreign key
Foreign keys are the column of the
table used to point to the primary key
of another table. Every employee
works in a specific department in a
company, and employee and
department are two different entities.
So we can't store the department's
information in the employee table.
That's why we link these two tables
through the primary key of one table.
We add the primary key of the DEPARTMENT table, Department_Id, as a new attribute in the
EMPLOYEE table.
In the EMPLOYEE table, Department_Id is the foreign key, and both the tables are related.
- SyncYourStat 6
2. Database System Concepts and Architecture BCA/BIT 2019 - CITE - DBMS
Alternate Key
Remaining candidate keys other than primary keys are alternate keys.
- SyncYourStat 7