07 Database Concepts
7.1 Introduction
In the modern digital world, organisations and individuals deal with large volumes of data every day. This data needs to be stored, managed, retrieved, and updated efficiently. Simple storage methods such as text files or spreadsheets are not sufficient when data becomes large, complex, or shared among multiple users. To address these challenges, the concept of databases was introduced.
According to the NCERT textbook, a database is an organised collection of related data that is stored and accessed electronically in a computer system. Databases help in managing data efficiently and systematically.
Need for Databases
NCERT highlights the need for databases due to the following reasons:
- Large volume of data to be stored
- Data needs to be shared among multiple users
- Data must be accessed quickly and accurately
- Data should be protected from unauthorised access
- Data should be easy to update and maintain
Databases provide a structured way to handle these requirements.
What Is Data in the Context of Databases
In databases, data refers to facts related to real-world entities. Examples:
- Student roll number, name, marks
- Employee ID, department, salary
- Product code, price, quantity
Each piece of data represents a specific attribute of an entity.
Traditional Data Storage vs Database Approach
Before databases were introduced, data was commonly stored using file-based systems. NCERT introduces databases by comparing them with traditional file systems.
| File-Based System | Database System |
|---|---|
| Data stored in separate files | Data stored in integrated database |
| Data redundancy common | Reduced data redundancy |
| Difficult to update | Easy to update |
| Limited security | Better security |
| Poor data sharing | Efficient data sharing |
This comparison helps students understand why databases are preferred.
Features of a Database
A database has the following important features:
- Stores large amounts of data
- Data is organised in a structured manner
- Supports easy retrieval and updating
- Allows multi-user access
- Provides data security and integrity
These features make databases suitable for real-world applications.
Examples of Database Usage
NCERT mentions several real-life situations where databases are used:
- School management systems
- Banking systems
- Railway reservation systems
- Hospital record systems
- Online shopping platforms
In all these systems, data is continuously created, updated, and accessed.
Advantages of Using Databases
Databases offer many advantages:
- Efficient data management
- Reduced duplication of data
- Faster data access
- Improved data consistency
- Better data security
These advantages explain why databases are a fundamental component of modern information systems.
Database and Database Management System (Conceptual Link)
NCERT introduces the idea that a database alone is not sufficient. A special software is required to manage the database. This software is known as a Database Management System (DBMS), which will be discussed in later sections.
At this stage, students should understand that:
- Database β Collection of data
- DBMS β Software to manage the database
Key Points to Remember (NCERT-Oriented)
- A database is an organised collection of related data
- Databases are used to handle large volumes of data
- File-based systems have limitations
- Databases reduce redundancy and improve efficiency
- Databases are widely used in real-life applications
7.2 File System
Before the development of databases, data was stored and managed using the file system approach. In this approach, data is stored in separate files, and each file is created and managed by application programs. Although this method was sufficient for small and simple applications, it became inefficient as data volume and complexity increased.
According to the NCERT textbook, a file system is a method of storing data in individual files, where each file is designed for a specific application.
Understanding the File System Approach
In a file system:
- Each application has its own data files
- Data is stored in different formats
- Programs directly access files
- There is no central control over data
For example:
- One file may store student personal details
- Another file may store student marks
- A separate file may store fee details
Each file is maintained independently.
Working of a File-Based System (Conceptual)
The basic working of a file-based system is as follows:
- Application program requests data
- The program directly accesses the data file
- Data is read or modified by the program
- Changes are saved back to the file
There is no separate software layer to manage data centrally.
Limitations of the File System
NCERT clearly explains that the file system approach suffers from several serious limitations, which led to the development of database systems.
1. Data Redundancy
Data redundancy refers to the duplication of data at multiple locations.
In a file system:
- Same data may be stored in multiple files
- This increases storage space requirement
Example (Conceptual):
- Student name stored in admission file
- Same student name stored again in examination file
π NCERT Exam Point Data redundancy leads to unnecessary duplication of data.
2. Data Inconsistency
Data inconsistency occurs when different copies of the same data do not match.
This happens because:
- Updating data in one file may not update it in other files
- Files are managed independently
Example:
- Student address updated in one file
- Old address remains in another file
π NCERT Observation Data inconsistency is a direct result of data redundancy.
3. Difficulty in Data Access
In a file system:
- Retrieving specific data is difficult
- New programs must be written for new data requirements
This makes data access:
- Time-consuming
- Rigid
- Inflexible
File systems do not support ad-hoc queries easily.
4. Lack of Data Integrity
Data integrity refers to the accuracy and correctness of data.
In file systems:
- Integrity rules are difficult to enforce
- Invalid data may be entered
- No central control to ensure correctness
Example:
- Marks exceeding maximum limit
- Invalid roll numbers
5. Lack of Data Security
Data security is a major concern in file-based systems.
Limitations include:
- No proper access control
- Difficult to restrict unauthorised users
- Sensitive data may be exposed
π NCERT Exam Point File systems provide poor data security.
6. No Data Sharing
In a file system:
- Data sharing among users is limited
- Concurrent access by multiple users is difficult
- Leads to conflicts and data corruption
This makes file systems unsuitable for multi-user environments.
7. ProgramβData Dependence
In file-based systems:
- Programs are tightly linked to file structures
- Any change in file structure requires program modification
This results in:
- High maintenance cost
- Reduced flexibility
Summary of Limitations of File System
| Limitation | Description |
|---|---|
| Data redundancy | Same data stored multiple times |
| Data inconsistency | Conflicting data values |
| Poor security | No proper access control |
| Lack of integrity | Incorrect or invalid data |
| Difficult access | Rigid data retrieval |
| No data sharing | Limited multi-user support |
| Program-data dependence | High maintenance effort |
Need for an Improved System
Due to the above limitations, file-based systems are not suitable for modern applications that require:
- Large data storage
- Frequent updates
- Multiple users
- Strong security
- High data consistency
This led to the development of Database Management Systems (DBMS), which overcome most of these problems.
Key Points to Remember (NCERT-Oriented)
- File system stores data in separate files
- Each application manages its own data
- File systems suffer from redundancy and inconsistency
- Security and integrity are weak
- File systems are inflexible and difficult to maintain
- DBMS was developed to overcome these limitations
7.3 Database Management System (DBMS)
As discussed earlier, file-based systems have several limitations such as data redundancy, inconsistency, poor security, and difficulty in data access. To overcome these problems, a specialised software system known as a Database Management System (DBMS) was developed.
According to the NCERT textbook, a Database Management System (DBMS) is a software system that enables users to define, create, store, manage, and manipulate databases in an efficient and controlled manner.
In simple terms, a DBMS acts as an interface between the database and the users or application programs.
What a DBMS Does
A DBMS performs the following key roles:
- Stores data in an organised manner
- Controls access to the database
- Allows multiple users to share data
- Ensures data security and integrity
- Reduces data redundancy
Without a DBMS, managing large volumes of data would be extremely difficult.
Components of a DBMS Environment
NCERT explains that a DBMS environment consists of the following components:
1. Database
- The collection of related data
- Stores actual data values
- Organised in tables (in relational databases)
2. DBMS Software
- The software that manages the database
- Handles storage, retrieval, and updates
- Provides tools for data definition and manipulation
3. Users
Different types of users interact with the DBMS:
- Database Administrators (DBA) β Manage and control the database
- Application Programmers β Develop programs that access the database
- End Users β Use the database for queries and reports
4. Application Programs
- Programs written to interact with the database
- Used to retrieve and modify data
- Examples include management systems and reporting tools
π NCERT Exam Point A DBMS provides a centralised control over data.
Functions of a DBMS
A Database Management System performs several important functions:
1. Data Storage Management
- Stores data efficiently on storage media
- Organises data systematically
- Manages large volumes of data
2. Data Retrieval and Manipulation
- Allows users to retrieve specific data
- Supports insertion, deletion, and modification of data
- Enables flexible data access
3. Data Security
- Controls access to data
- Prevents unauthorised users from accessing sensitive data
- Implements user permissions
4. Data Integrity Management
- Ensures accuracy and consistency of data
- Enforces rules and constraints
- Prevents invalid data entry
5. Data Sharing and Concurrency Control
- Allows multiple users to access data simultaneously
- Prevents conflicts during simultaneous updates
- Maintains consistency in multi-user environments
6. Backup and Recovery
- Protects data from loss
- Provides recovery mechanisms in case of system failure
Advantages of Using a DBMS
NCERT highlights several advantages of DBMS over file-based systems:
- Reduced data redundancy
- Improved data consistency
- Enhanced data security
- Better data sharing
- Easy data access and management
- Reduced application development time
DBMS vs File System (Summary Comparison)
| File System | DBMS |
|---|---|
| Data stored in files | Data stored in database |
| High redundancy | Reduced redundancy |
| Poor security | Strong security |
| Programβdata dependence | Data independence |
| Difficult data access | Flexible queries |
Data Independence (Conceptual)
One important feature of DBMS is data independence.
- Changes in data structure do not require changes in application programs
- Improves flexibility and reduces maintenance effort
NCERT introduces this concept at a basic level.
Examples of DBMS Applications
DBMS is used in many real-world systems:
- Banking systems
- Airline reservation systems
- School and college databases
- Hospital management systems
- Online shopping platforms
In all these systems, large amounts of data are handled efficiently using a DBMS.
Key Points to Remember (NCERT-Oriented)
- DBMS is software used to manage databases
- It acts as an interface between users and data
- DBMS provides security, integrity, and sharing
- DBMS reduces redundancy and inconsistency
- DBMS supports multi-user environments
7.4 Relational Data Model
To organise data efficiently within a database, a specific structure or model is required. One of the most widely used and simple data models is the Relational Data Model. NCERT introduces this model because it is easy to understand and forms the foundation of most modern database systems.
According to the NCERT textbook, the Relational Data Model represents data in the form of tables, where data is stored in rows and columns.
Meaning of Relational Data Model
In the relational data model:
- Data is organised into relations (tables)
- Each relation consists of rows and columns
- Relationships between data are represented logically
This model was proposed by E. F. Codd and is widely used due to its simplicity and effectiveness.
Basic Terminology of Relational Data Model
NCERT places strong emphasis on understanding the basic terms used in the relational data model. These terms are frequently asked in exams.
Relation (Table)
A relation is a table that stores data about a specific entity.
Example (conceptual):
- STUDENT table
- EMPLOYEE table
Each table represents one type of entity.
π NCERT Exam Point In the relational model, a table is called a relation.
Tuple (Row)
A tuple represents a single record in a table.
- Each row corresponds to one instance of an entity
- Example: Details of one student
π NCERT Observation Each tuple represents one complete set of values.
Attribute (Column)
An attribute represents a property or characteristic of an entity.
Examples:
- Roll Number
- Name
- Age
- Marks
Each column in a table is an attribute.
Domain
A domain is the set of all possible values that an attribute can take.
Example:
- Domain of Age β integers from 0 to 120
- Domain of Gender β Male, Female
Domains help maintain data integrity by restricting values.
Degree of a Relation
The degree of a relation is the number of attributes (columns) in a table.
Example:
- A table with 5 columns has degree 5
Cardinality of a Relation
The cardinality of a relation is the number of tuples (rows) in a table.
Example:
- A table with 100 rows has cardinality 100
π NCERT Exam Point Degree β Columns Cardinality β Rows
Structure of a Relational Table (Conceptual)
A relational table consists of:
- Table name
- Set of attributes (columns)
- Set of tuples (rows)
Each cell in the table contains atomic (indivisible) values.
Characteristics of a Relation
NCERT outlines the following important characteristics of relations:
- Each table has a unique name
- Each column has a unique name within a table
- Each cell contains a single value
- Order of rows and columns does not matter
- No two rows are identical
These characteristics ensure consistency and clarity.
Advantages of Relational Data Model
The relational data model offers several benefits:
- Simple and easy to understand
- Data stored in tabular format
- Reduced data redundancy
- Easy data retrieval
- Strong data integrity
Because of these advantages, most DBMS use the relational model.
Relational Model and DBMS
In a relational DBMS:
- Data is stored in tables
- Tables are related using keys
- Operations are performed using queries
NCERT introduces this concept to prepare students for future learning in SQL and database operations.
Relational Data Model vs File System (Conceptual)
| File System | Relational Data Model |
|---|---|
| Data stored in files | Data stored in tables |
| High redundancy | Reduced redundancy |
| No structure | Structured format |
| Difficult queries | Easy data retrieval |
Key Points to Remember (NCERT-Oriented)
- Relational data model organises data in tables
- Tables are called relations
- Rows are tuples and columns are attributes
- Domain defines allowed values
- Degree and cardinality describe table size
- Relational model is simple and powerful
7.5 Keys in a Relational Database
In a relational database, data is stored in tables. To uniquely identify records, establish relationships between tables, and maintain data integrity, special fields known as keys are used.
According to the NCERT textbook, keys are attributes or sets of attributes that help in uniquely identifying tuples (rows) in a relation and establishing relationships between relations.
Keys play a very important role in the relational data model and are frequently asked in examinations.
Why Keys Are Needed
NCERT explains that keys are needed to:
- Uniquely identify each record in a table
- Avoid duplicate records
- Establish relationships between tables
- Maintain data integrity and consistency
- Enable efficient data retrieval
Without keys, managing relational databases becomes difficult and error-prone.
Types of Keys in a Relational Database
At the Class XI level, NCERT introduces the following main types of keys:
- Super Key
- Candidate Key
- Primary Key
- Alternate Key
- Foreign Key
Each type of key has a specific purpose.
7.5.1 Super Key
A super key is a set of one or more attributes that can uniquely identify a tuple in a relation.
- A super key may contain extra attributes
- Uniqueness is guaranteed
Example (Conceptual): In a STUDENT table:
- {RollNumber}
- {RollNumber, Name}
Both can uniquely identify a student, so both are super keys.
π NCERT Exam Point Every candidate key is a super key, but not every super key is a candidate key.
7.5.2 Candidate Key
A candidate key is a minimal super key.
- It uniquely identifies each tuple
- It contains no unnecessary attributes
Example: If RollNumber alone can uniquely identify students, then:
- RollNumber β Candidate Key
Characteristics of Candidate Key
- Must be unique
- Must be minimal
- A table can have multiple candidate keys
7.5.3 Primary Key
A primary key is a candidate key chosen by the database designer to uniquely identify records in a table.
Characteristics of Primary Key
- Must have unique values
- Cannot be NULL
- Only one primary key per table
- Ensures entity integrity
Example: In STUDENT table:
- RollNumber β Primary Key
π NCERT Exam Point A primary key cannot contain NULL values.
7.5.4 Alternate Key
An alternate key is a candidate key that is not selected as the primary key.
- Used as an alternative unique identifier
- Still maintains uniqueness
Example: If both RollNumber and AadhaarNumber are candidate keys:
- RollNumber β Primary Key
- AadhaarNumber β Alternate Key
7.5.5 Foreign Key
A foreign key is an attribute in one table that refers to the primary key of another table.
Purpose of Foreign Key
- Establishes relationship between tables
- Maintains referential integrity
- Prevents invalid data entry
Example (Conceptual)
- STUDENT table β Primary Key: RollNumber
- MARKS table β RollNumber is Foreign Key
This links marks records to student records.
π NCERT Exam Point Foreign keys help in linking two relations.
Relationship Between Primary Key and Foreign Key
| Primary Key | Foreign Key |
|---|---|
| Uniquely identifies records | Refers to primary key |
| Cannot be NULL | Can be NULL |
| One per table | Can be many per table |
| Ensures entity integrity | Ensures referential integrity |
Summary Table: Types of Keys
| Key Type | Purpose |
|---|---|
| Super Key | Uniquely identifies records |
| Candidate Key | Minimal super key |
| Primary Key | Selected candidate key |
| Alternate Key | Candidate key not chosen |
| Foreign Key | Links two tables |
Importance of Keys in Relational Databases
Keys ensure:
- Data uniqueness
- Proper relationships
- Data integrity
- Efficient database operations
Without keys, relational databases lose their structure and reliability.
Key Points to Remember (NCERT-Oriented)
- Keys uniquely identify records
- Candidate keys are minimal and unique
- Only one primary key per table
- Alternate keys are unused candidate keys
- Foreign keys establish relationships
- Keys maintain data integrity