II PUC 2025-26 (New syllabus) Computer Science Chapter 8 database concepts
r
to
Chapter 8 Database concepts
Data:
Data is a collection of characters, numbers, and other symbols that represents values of some situations or variables.
di
The generated data need to be stored and managed. This can be done manually or electronically.
E
Manual data recording
Storing, entering, or recording the data in a register or paper manually by human is called as manual data recording.
Example: student attendance register in a college.
F
Electronic data recording
D
Storing or recording the data directly in a file stored in a secondary storage device is called as electronic data recording.
Example: ATM transactions.
rP
Limitations of manual data recording
As the volume of data increases, manual data entry becomes tedious job.
Loss of data if the register or paper is lost or damaged.
te
May not get accurate results.
Redundant (duplicate) data entry.
as
Data inconsistency.
Finding, modifying, deleting the data is difficult task.
File system
M
A file is a container to store data in a computer, which can be stored on the storage device of a computer system.
Contents of a file can be texts, computer program code, comma separated values (CSV), etc.
Pictures, audios, videos, web pages are also files.
in
Files stored on a computer can be searched, accessed directly.
However, to access data of a file separate software is required.
ed
Limitations of a File System: File system becomes difficult to handle when number of files increases and volume of data also grows.
Following are some of the limitations of file system,
at
re
1
II PUC 2025-26 (New syllabus) Computer Science Chapter 8 database concepts
r
to
a) Difficulty in Access
b) Data Redundancy
c) Data Inconsistency
di
d) Data Isolation
e) Data Dependence
E
f) Controlled Data Sharing
a) Difficulty in Access
F
Files do not provide any mechanism to retrieve data stored in it.
It is difficult to access data in the required format.
D
Application programs, software is required to access the data stored in file system.
rP
b) Data Redundancy
Redundancy means same data are duplicated in different files.
Redundancy leads to excess storage use and may cause data inconsistency.
te
c) Data Inconsistency
Data inconsistency means, when same data maintained in different places do not match.
This situation occurs when different people are maintaining the files.
as
d) Data Isolation
This means when there is no link or mapping between the data stored in different places.
M
If different person generates data files at different times, files being created in isolation may be of different formats.
It is difficult to write new application programs, software to retrieve data from different files maintained at multiple places.
in
e) Data Dependence
Data are stored in a specific format or structure in a file.
If the structure or format of data is changed, all the existing application programs accessing that file also need to be changed.
ed
Otherwise, the programs may not work correctly. This is data dependency.
Hence, updating the structure of a data file requires modification in all the application programs accessing that file.
at
f) Controlled Data Sharing
Different category of users access the data for different purpose.
Some users need limited access of data and some users need full access of data.
re
In file system, it is not possible to share the data in different form for different users.
2
II PUC 2025-26 (New syllabus) Computer Science Chapter 8 database concepts
r
to
Database Management System (DBMS): DBMS is a software used to create, store, manage, update, modify, delete, retrieve, and
manage database.
di
Some examples of open source and commercial DBMS are
1) MySQL
E
2) Oracle
3) PostgreSQL
4) SQL Server
F
5) Microsoft Access
6) MongoDB.
D
Points to remember
rP
1) Abstract view: A database system provides abstract view of the data by hiding certain details about how data are actually stored
and maintained.
2) Set of programs: Database system has a set of programs through which users or other programs can access, modify and retrieve
te
the stored data.
3) Interface:
as
The DBMS serves as an interface between the database and end users or application programs.
Some database management systems include a graphical user interface for users to create and manage databases.
Some other database systems use a command line interface that requires users to use programming commands to create and
manage databases.
M
4) Querying the database: retrieving the data, modifying the structure of the database through special type of commands is called as
in
querying.
Uses or applications of database in real life
Application Database to maintain data about
ed
Banking Customer information, account details, loan details, transactions details etc.
Crop Loan kisan credit card data, farmer’s personal data, land area and cultivation data, loan
history, repayment data, etc.
at
Inventory Management product details, customer information, order details, delivery data, etc.
Organization Resource Management employee records, salary details, department information, branch locations, etc.
re
Online Shopping items description, user login details, users preferences details, etc.
3
II PUC 2025-26 (New syllabus) Computer Science Chapter 8 database concepts
r
to
File system to DBMS
File system to DBMS conversion is required because of following reasons
In file system, same data may be present in multiple files.
di
In file system, some files may contain redundant data.
In file system, it is not possible to represent data uniquely.
E
Note:
High Cost is required in shifting from file system to DBMS:
F
• Purchasing sophisticated hardware and software.
• Training users for querying.
D
• Maintenance cost is required to take regular backup and perform recovery operations.
rP
Key concepts in DBMS
a) Database Schema
Database Schema is the design of a database that represents,
Structure (table names and their fields/columns) of table.
te
The type of data each column can hold.
Constraints on the data to be stored (if any).
The relationships among the tables.
as
Database schema is also called the visual or logical architecture as it tells how the data are organized in a database.
b) Data constraint
M
It is the restrictions or limitations on the type of data that can be inserted in columns of a table.
Constraints are specified on columns while creating the tables.
Constraints are used to ensure accuracy and reliability of data in the database.
in
For example
Defining a column mobile number can only have non-negative integer values of exactly 10 digits.
Defining NOT NULL and UNIQUE constraints on the Roll_Number column, as roll number is unique.
ed
c) Meta data or data dictionary
The database schema along with various constraints on the data is stored by DBMS in a database catalog or dictionary, called
meta-data.
at
A meta-data is data about the data.
re
4
II PUC 2025-26 (New syllabus) Computer Science Chapter 8 database concepts
r
to
d) Database Instance
It is the state or snapshot of the database at any given time after storing data in database.
Then user may retrieve data through queries or manipulate data through updating, modification or deletion.
di
Thus, the state of database can change, and thus a database schema can have many instances at different times.
E
e) Query
A query is a request to a database for obtaining information in a desired way.
Query can be made to get data from one table or from a combination of tables.
F
To retrieve or manipulate data, the user needs to write query using a query language SQL (Structured Query Language).
For example, “find names of all students with more the 85% percentage”.
D
f) Data Manipulation
rP
Modification of database consists of three operations viz. Insertion, Deletion or Update.
Adding new rows, records to the database table is called as Insertion operation on the database.
Deleting or removing rows, records from the database table is called as deletion operation on the database.
Changing or modifying the existing rows, records in the database table is called as Update operation on the database.
te
g) Database Engine: Database engine is the underlying component or set of programs used by a DBMS to create database and
as
handle various queries for data retrieval and manipulation.
Limitations of DBMS
Increased Complexity: Use of DBMS increases the complexity of maintaining functionalities like security, consistency,
sharing and integrity
M
Increased data vulnerability: As data are stored centrally, it increases the chances of loss of data due to any failure of
hardware or software. It can bring all operations to a halt for all the users.
in
Data Model
A data model describes the structure of the database, including how data are defined and represented, relationships among
ed
data, and the constraints.
The most commonly used data model is Relational Data Model.
Other types of data models include object-oriented data model, entity-relationship data model, document model and
at
hierarchical data model.
re
5
II PUC 2025-26 (New syllabus) Computer Science Chapter 8 database concepts
r
to
Relational Data Model
In relational model, tables are called as relations that store data for different columns. Each row in the table represents a related
set of values.
di
Each table can have multiple columns and column name should be unique.
Relations (table) in a database are dependent and are associated with each other.
E
If linking attributes are not there in appropriate relations (table), it will not be possible to keep the database in correct state
and retrieve valid information from the database.
F
Commonly used terminologies in relational data model
D
ATTRIBUTE:
Characteristic or parameters for which data are to be stored in a relation.
Simply stated, the columns of a relation are the attributes which are also referred as fields.
rP
TUPLE:
Each row of data in a relation (table) is called a tuple.
In a table with n columns, a tuple is a relationship between the n related values.
te
DOMAIN:
as
It is a set of values from which an attribute can take a value in each row.
a data type is used to specify domain for an attribute.
M
DEGREE: The number of attributes in a relation is called the Degree of the relation.
CARDINALITY: The number of tuples in a relation is called the Cardinality of the relation.
in
Three Important Properties of a Relation
In relational data model, following three properties are observed with respect to a relation which makes a relation different from a
data file or a simple table.
ed
Property 1: imposes following rules on an attribute of the relation.
Each attribute in a relation has a unique name.
Sequence of attributes in a relation is not important.
at
Property 2: governs following rules on a tuple of a relation.
re
Each tuple in a relation is distinct.
6
II PUC 2025-26 (New syllabus) Computer Science Chapter 8 database concepts
r
to
Sequence of tuples in a relation is not important
The tuples are not considered to be ordered, even though they appear to be in tabular form.
di
Property 3: imposes following rules on the state of a relation.
All data values in an attribute must be from the same domain (same data type).
E
Each data value associated with an attribute must be atomic (cannot be further divisible into meaningful subparts).
No attribute can have many data values in one tuple.
A special value “NULL” is used to represent values that are unknown or non-applicable to certain attributes.
F
Keys in a Relational Database
D
Key is an attribute or a set of attributes used to uniquely identify each row (tuple) in a table (relation).
The tuples within a relation must be distinct, unique.
rP
There should be at least one attribute in which data are distinct (unique) and not NULL.
Relational data model imposes some restrictions or constraints on the values of the attributes and how the contents of one
relation be referred through another relation.
These restrictions are specified at the time of defining the database through different types of keys.
te
Candidate Key: In a relation, one or more attributes can take distinct values to uniquely identify the tuples in the relation. Such
as
attributes are called candidate keys.
Primary Key: Out of one or more candidate keys, the attribute chosen by the database designer to uniquely identify the tuples in a
M
relation is called the primary key of that relation.
Alternate keys: These are the candidate keys but not selected as primary keys.
in
Composite Primary Key: If more than one attribute are taken together as primary key then it is called Composite Primary key.
Foreign Key
ed
A foreign key is an attribute whose value is derived from the primary key of another relation.
A foreign key is used to represent the relationship between two relations (tables).
This means that any attribute of a relation (referencing), which is used to refer contents from another (referenced) relation,
becomes foreign key if it refers to the primary key of referenced relation.
at
The referencing relation is called Foreign Relation.
The relation in which the referenced primary key is defined is called primary relation or master relation.
re
In some cases, foreign key can take NULL value if it is not the part of primary key of the foreign table.