2nd pu notes

2nd PUC Computer Science Chapter 8 Database Concepts Notes | NCERT Board 2026

Venkatesh A September 6, 2026 29 min read
verakworld.com

2nd PUC / Class XII Computer Science

Complete Short Notes & Exam Preparation Guide

Based on the NCERT textbook

verakworld.com

Chapter Overview

This chapter explains the need for storing and managing data electronically. It begins with the limitations of manual record keeping and file systems, then introduces Database Management Systems (DBMS), the relational data model, important relational database terminology and different types of keys.

8.1 Introduction

Data is important and needs to be stored and managed electronically. The chapter uses the example of a school that maintains student details, attendance records and guardian details.

In a manual attendance register, the teacher records P for present and A for absent against each student’s roll number for every working day.

Example from the chapter: If class strength is 50 and the total working days in a month are 26, the teacher needs to manually record 50 × 26 records every month.

Limitations of Manual Record Keeping

  1. Student details have to be entered again in the new attendance register when a student is promoted to the next class.
  2. Writing student details on every month’s attendance page may cause inconsistency because names may be written incorrectly or records may be skipped.
  3. Data may be lost if the attendance register is lost or damaged.
  4. Manual consolidation of attendance may result in erroneous calculations.

Why Computerised Data Storage?

Student and attendance details can be stored in separate data files on a computerised system. This allows office staff and teachers to:

  1. Copy student details to the new attendance file when students are promoted.
  2. Find information about a student or guardian.
  3. Add details whenever a new student joins the school.
  4. Modify stored student or guardian information when required.
  5. Remove or delete data when a student leaves the school.

Student and Guardian Details

The office staff maintains student details such as Roll Number, Name and Date of Birth, along with guardian details such as Guardian Name, Contact Number and Address. These details are required for correspondence with guardians regarding attendance and results.

⭐ Exam Point: Manual record keeping becomes difficult when the amount of data increases. Computerised storage makes searching, adding, modifying and deleting data easier.
verakworld.com

8.2 File System

File: A file can be understood as a container used to store data in a computer. Files can be stored on the storage device of a computer system.

The contents of a file may include text, computer program code, comma separated values (CSV), pictures, audio/video and web pages.

Files stored on a computer can be accessed directly and searched for desired data. However, to access data from a file through software, application programs need to be written.

School Attendance Example

Two separate files are maintained:

STUDENT file

Contains student and guardian-related information.

ATTENDANCE file

Contains attendance information.

Table 8.1 — STUDENT File

Roll Number SName SDateofBirth GName GPhone GAddress
1Atharv Ahuja2003-05-15Amit Ahuja5711492685G-35, Ashok Vihar, Delhi
2Daizy Bhutia2002-02-28Baichung Bhutia7110047139Flat no. 5, Darjeeling Appt., Shimla
3Taleem Shah2002-02-28Himanshu Shah981818485526/77, West Patel Nagar, Ahmedabad
4John Dsouza2003-08-18Danny DsouzaS -13, Ashok Village, Daman
5Ali Shah2003-07-05Himanshu Shah981818485526/77, West Patel Nagar, Ahmedabad
6Manika P.2002-03-10Sujata P.7802983674HNO-13, B- block, Preet Vihar, Madurai
verakworld.com

Table 8.2 — ATTENDANCE File

AttendanceDate RollNumber SName AttendanceStatus
2018-09-011Atharv AhujaP
2018-09-012Daizy BhutiaP
2018-09-013Taleem ShahA
2018-09-014John DsouzaP
2018-09-015Ali ShahA
2018-09-016Manika P.P
2018-09-021Atharv AhujaP
2018-09-022Daizy BhutiaP
2018-09-023Taleem ShahA
2018-09-024John DsouzaA
2018-09-025Ali ShahP
2018-09-026Manika P.P
verakworld.com

8.2.1 Limitations of a File System

A file system becomes difficult to handle when the number of files increases and the volume of data grows.

(A) Difficulty in Access

Files themselves do not provide a mechanism to retrieve data. Data in a file system is accessed through application programs. While developing such programs, all possible ways of accessing data may not be anticipated. Therefore, accessing data in the required format may become difficult and an application program may have to be written.

(B) Data Redundancy

Data Redundancy: Redundancy means that the same data is duplicated in different places or files.

In the school example, student names occur in both STUDENT and ATTENDANCE files. Guardian information may also be repeated. For example, students with roll numbers 3 and 5 have the same guardian name.

Redundancy results in excess storage usage and may also cause data inconsistency.

(C) Data Inconsistency

Data Inconsistency: Data inconsistency occurs when the same data maintained in different places does not match.

If a student’s name spelling is changed, it has to be changed in both files. Similarly, when a student leaves school, the details should be deleted from both files. Since different people may maintain different files, the changes may not happen everywhere, resulting in inconsistent data.

(D) Data Isolation

STUDENT and ATTENDANCE files contain related student information, but there is no link or mapping between them in a file system.

Separate programs have to be written to access the files. In a complex system, files created by different people at different times may have different formats. This makes it difficult to retrieve information from multiple files.

(E) Data Dependence

Data is stored in a specific format or structure in a file. If that structure or format changes, all existing application programs accessing that file also need to be changed.

Exam Point: Updating the structure of a data file requires modification in all application programs that access the file.

(F) Controlled Data Sharing

Different users such as teachers, office staff and parents may need different levels of access. Not every user should be able to access all data.

For example, guardians and office staff may be allowed to view attendance but should not be able to modify or delete it. Only the teacher should be able to update attendance data.

Enforcing such access control through application programs in a file system is difficult.

⭐ Remember: Difficulty in Access, Data Redundancy, Data Inconsistency, Data Isolation, Data Dependence and Controlled Data Sharing are the important limitations of a file system described in this chapter.
verakworld.com

8.3 Database Management System

Database Management System (DBMS): A DBMS or database system is software used to create and manage databases.

The limitations of a file system can be overcome by storing data in a database where data is logically related.

DBMS allows users or application programs to create a database, store data, manage data, update or modify data and retrieve data.

Examples of DBMS Mentioned in the Chapter

MySQL
Oracle
PostgreSQL
SQL Server
Microsoft Access
MongoDB

Database System

A database system hides certain details about how data is actually stored and maintained. It provides users with an abstract view of the data.

A database system has a set of programs through which users or other programs can access, modify and retrieve stored data.

DBMS as an Interface

End Users / Application Programs
DBMS
Database
verakworld.com

DBMS serves as an interface between the database and end users or application programs.

Querying the Database: Retrieving data from a database through special types of commands is called querying the database.

Users can also modify the structure of a database through a DBMS.

Table 8.3 — Use of Database in Real-Life Applications

Application Database to Maintain Data About
Banking Customer information, account details, loan details, transaction details, etc.
Crop Loan Kisan credit card data, farmer’s personal data, land area and cultivation data, loan history, repayment data, etc.
Inventory Management Product details, customer information, order details, delivery data, etc.
Organisation Resource Management Employee records, salary details, department information, branch locations, etc.
Online Shopping Items description, user login details, users preferences details, etc.
⭐ Exam Point: DBMS is software that creates and manages databases and provides operations such as storing, updating, modifying and retrieving data.
verakworld.com

8.3.1 File System to DBMS

In the school example, STUDENT and ATTENDANCE are separate files. Tables in a database can be linked or related through one or more common columns or fields.

STUDENT and ATTENDANCE have RollNumber and SName as common field names.

Changes Required to Convert the Files into a Database

(a) Remove Repeated SName from ATTENDANCE

SName need not be maintained in ATTENDANCE because it is already available in STUDENT. Student details can be retrieved using the common field RollNumber in both files.

(b) Avoid Repeated Guardian Details

If two siblings are in the same class, the same guardian details (GName, GPhone and GAddress) may be maintained for both.

This is redundancy. To avoid it, the STUDENT file can be split into STUDENT and GUARDIAN files so that each guardian’s data is maintained only once.

(c) Create GUID

More than one guardian can have the same name. Therefore, guardian name alone cannot identify which guardian is related to which student.

An additional column called GUID (Guardian ID) is created. GUID takes a unique value for each record in the GUARDIAN file and is also stored in STUDENT to relate the two files.

Guardians could also be distinguished using phone numbers, but a phone number can change and therefore may not truly distinguish a guardian.

Figure 8.1 — Record Structure of STUDENTATTENDANCE Database

STUDENT
RollNumber
SName
SDateofBirth
GUID
GUARDIAN
GUID
GName
GPhone
GAddress
ATTENDANCE
AttendanceDate
RollNumber
AttendanceStatus

Record structure of three files in STUDENTATTENDANCE database.

verakworld.com
Textbook Note: The shown structure is not the complete database schema because it does not show any relationship among the tables.

Table 8.4 — Snapshot of STUDENT Table

RollNumber SName SDateofBirth GUID
1Atharv Ahuja2003-05-15444444444444
2Daizy Bhutia2002-02-28111111111111
3Taleem Shah2002-02-28
4John Dsouza2003-08-18333333333333
5Ali Shah2003-07-05101010101010
6Manika P.2002-03-10466444444666
verakworld.com

Table 8.5 — Snapshot of GUARDIAN Table

GUID GName GPhone GAddress
444444444444Amit Ahuja5711492685G-35, Ashok Vihar, Delhi
111111111111Baichung Bhutia3612967082Flat no. 5, Darjeeling Appt., Shimla
101010101010Himanshu Shah472630921226/77, West Patel Nagar, Ahmedabad
333333333333Danny DsouzaS -13, Ashok Village, Daman
466444444666Sujata P.3801923168HNO-13, B- block, Preet Vihar, Madurai
verakworld.com

Table 8.6 — Snapshot of ATTENDANCE Table

Date RollNumber Status
2018-09-011P
2018-09-012P
2018-09-013A
2018-09-014P
2018-09-015A
2018-09-016P
2018-09-021P
2018-09-022P
2018-09-023A
2018-09-024A
2018-09-025P
2018-09-026P
verakworld.com

Cost of Shifting from File System to DBMS

  • Purchasing sophisticated hardware and software.
  • Training users for querying.
  • Recurrent cost for regular backup and recovery operations.

DBMS and Centralised Data

The simplified STUDENTATTENDANCE database maintains a single repository of data at a centralised location and can be used by multiple users, such as office staff and teachers, at the same time.

8.3.2 Key Concepts in DBMS

(A) Database Schema

Database Schema: The design of a database. It is the skeleton of a database that represents table names and fields/columns, the type of data each column can hold, constraints on the data and relationships among tables.

Database schema is also called the visual or logical architecture because it tells us how data is organised in a database.

(B) Data Constraint

Data Constraint: A restriction or limitation placed on the type of data that can be inserted in one or more columns of a table.

For example, a mobile number column can be restricted to non-negative integer values of exactly 10 digits. Since each student should have one unique roll number, NOT NULL and UNIQUE constraints can be placed on the RollNumber column.

Constraints are used to ensure accuracy and reliability of data in a database.

(C) Meta-data or Data Dictionary

The database schema along with various constraints on the data is stored by the DBMS in a database catalog or dictionary called meta-data.

Meta-data means data about the data.

(D) Database Instance

When the database structure or schema is defined, the database state is empty because there is no data entry.

Database Instance: The state or snapshot of a database at any given time after data has been loaded.

Data can then be retrieved through queries or manipulated through updation, modification or deletion. Since the database state can change, one database schema can have many instances at different times.

Figure 8.2 — STUDENTATTENDANCE Database Environment

Student
Guardian
Attendance
Database
Catalog
DBMS Software
Query Result

Teacher and Office Staff interact with the database through DBMS.

verakworld.com

(E) Query

Query: A request to a database for obtaining information in a desired way.

A query can retrieve data from one table or from a combination of tables.

Example given in the chapter: finding the names of all students present on a particular attendance date.

To retrieve or manipulate data, the user writes a query using a query language.

(F) Data Manipulation

Modification of a database consists of three operations:

Operation Meaning in the Chapter Example
Insertion Adding details when a new student joins.
Deletion Removing student and guardian details when a student leaves.
Update Changing information such as a guardian’s mobile number.

(G) Database Engine

Database Engine: The underlying component or set of programs used by a DBMS to create databases and handle queries for data retrieval and manipulation.

Limitations of DBMS Mentioned in the Chapter

Increased Complexity

Use of DBMS increases the complexity of maintaining functionalities such as security, consistency, sharing and integrity.

Increased Data Vulnerability

Since data is stored centrally, the chances of data loss due to hardware or software failure increase. Such failure can bring operations to a halt for all users.

verakworld.com

8.4 Relational Data Model

Different DBMS types are classified based on their underlying data model. A data model describes the structure of a database, including how data is defined and represented, relationships among data and constraints.

The most commonly used data model is the Relational Data Model. Other data models mentioned in the chapter are:

  • Object-oriented data model
  • Entity-relationship data model
  • Document model
  • Hierarchical data model
Relational Model: In the relational model, tables are called relations and store data in columns.

Each table can have multiple columns, and each column name should be unique. Each row represents a related set of values.

For example, each row of the GUARDIAN relation represents a particular guardian with related values such as guardian ID, name, address and phone. Thus, a table consists of a collection of relationships.

Relations in a database are not independent tables; they are associated with each other.

ATTENDANCE has RollNumber which links it with the corresponding student record in STUDENT. GUID in STUDENT is used to obtain guardian details.

Table 8.7 — Relation Schemas and Description

Relation Schema Description of Attributes
STUDENT
(RollNumber, SName, SDateofBirth, GUID)
RollNumber: unique ID of the student
SName: name of the student
SDateofBirth: date of birth of the student
GUID: unique ID of the guardian of the student
ATTENDANCE
(AttendanceDate, RollNumber, AttendanceStatus)
AttendanceDate: date on which attendance is taken
RollNumber: roll number of the student
AttendanceStatus: whether present (P) or absent (A)
GUARDIAN
(GUID, GName, GPhone, GAddress)
GUID: unique ID of the guardian
GName: name of the guardian
GPhone: contact number of the guardian
GAddress: contact address of the guardian
Important: In ATTENDANCE, the combination of AttendanceDate and RollNumber is unique in each record.
verakworld.com

Relational Data Model Terminology

Attribute

Attribute: A characteristic or parameter for which data is stored in a relation. Simply stated, columns of a relation are attributes, also called fields.

Example: GUID, GName, GPhone and GAddress are attributes of the GUARDIAN relation.

Tuple

Tuple: Each row of data in a relation or table is called a tuple.

In a table with n columns, a tuple represents a relationship between the n related values.

Domain

Domain: A set of values from which an attribute can take a value in each row.

Usually, a data type specifies the domain of an attribute. For example, RollNumber may take integer values and SName may take character strings.

Degree

Degree: The number of attributes in a relation.

Example: GUARDIAN has four attributes, so its degree is 4.

Cardinality

Cardinality: The number of tuples in a relation.

Example: GUARDIAN has 5 tuples, so its cardinality is 5.

Figure 8.4 — Relation GUARDIAN

GUID GName GPhone GAddress
444444444444Amit Ahuja5711492685G-35, Ashok Vihar, Delhi
111111111111Baichung Bhutia3612967082Flat no. 5, Darjeeling Appt., Shimla
101010101010Himanshu Shah472630921226/77, West Patel Nagar, Ahmedabad
333333333333Danny DsouzaS -13, Ashok Village, Daman
466444444666Sujata P.3801923168HNO-13, B- block, Preet Vihar, Madurai
Facts about GUARDIAN relation:
Degree = 4
Cardinality = 5
It is a flat file: each column has a single value and each record has the same number of columns.
verakworld.com

8.4.1 Three Important Properties of a Relation

Property 1 — Rules for Attributes

  • Each attribute in a relation has a unique name.
  • The sequence of attributes in a relation is immaterial.

Property 2 — Rules for Tuples

  • Each tuple in a relation is distinct.
  • No two tuples of ATTENDANCE can have identical values for all attributes.
  • Each tuple must be uniquely identified by its contents.
  • The sequence of tuples in a relation is immaterial.
  • Tuples are not considered ordered even though they appear in tabular form.

Property 3 — Rules for the State of a Relation

  • All data values in an attribute must belong to the same domain or data type.
  • Each data value associated with an attribute must be atomic and cannot be further divided into meaningful subparts.
  • An attribute cannot contain many data values in one tuple.
  • NULL is used to represent unknown or non-applicable values.
Example: If a guardian does not share a contact number with school authorities, GPhone can be set to NULL because the data is unknown.
verakworld.com

8.5 Keys in a Relational Database

Tuples within a relation must be distinct. No two tuples should have the same value for all attributes.

There should be at least one attribute whose value is unique and not NULL so that each tuple can be uniquely distinguished.

Restrictions on attribute values and relationships between relations are specified through different types of keys.

8.5.1 Candidate Key

Candidate Key: One or more attributes that take distinct values and can be used to uniquely identify tuples in a relation. Each such attribute is a candidate for the primary key.

In GUARDIAN, GUID and GPhone are candidate keys because they take unique values.

8.5.2 Primary Key

Primary Key: The candidate key selected by the database designer to uniquely identify tuples in a relation.

The remaining candidate keys are called alternate keys.

Example: If GUID is selected as the primary key in GUARDIAN, GPhone becomes the alternate key.

8.5.3 Composite Primary Key

Composite Primary Key: A primary key consisting of more than one attribute, used when no single attribute can uniquely distinguish the tuples.

In ATTENDANCE, RollNumber cannot be the primary key because the same student’s roll number occurs for different dates. AttendanceDate also cannot be the primary key because the same date occurs for different students.

The combination of RollNumber and AttendanceDate is unique because a student’s attendance is marked only once on a working day.

Therefore: {RollNumber, AttendanceDate} forms the composite primary key of ATTENDANCE.

8.5.4 Foreign Key

Foreign Key: An attribute used to represent the relationship between two relations. Its value is derived from the primary key of another relation.
  • The referencing relation contains the foreign key.
  • The relation containing the referenced primary key is called the primary or master relation.
  • A foreign key may take NULL if it is not part of the primary key of the foreign table.
  • The foreign key is used to refer to information in another relation.

Figure 8.5 — Primary and Foreign Keys

STUDENT
RollNumber
SName
SDateofBirth
GUID
GUARDIAN
GUID
GName
GPhone
GAddress

ATTENDANCE
AttendanceDate
RollNumber
AttendanceStatus
STUDENT
RollNumber

The chapter represents foreign keys by directed arcs pointing to the corresponding primary-key attribute.

verakworld.com

Keys — Quick Comparison

Key Purpose Chapter Example
Candidate Key Can uniquely identify tuples and is a candidate for primary key. GUID, GPhone
Primary Key Selected candidate key used to uniquely identify tuples. GUID when selected in GUARDIAN
Alternate Key Candidate key not selected as primary key. GPhone when GUID is primary key
Composite Primary Key More than one attribute together uniquely identifies tuples. RollNumber + AttendanceDate
Foreign Key Represents relationship between two relations. GUID / RollNumber relationships shown in STUDENTATTENDANCE
verakworld.com

Chapter Summary

  • A file in a file system is a container used to store data in a computer.
  • File systems suffer from Data Redundancy, Data Inconsistency, Data Isolation, Data Dependence and Controlled Data Sharing limitations.
  • DBMS is software used to create and manage databases.
  • A database contains related tables.
  • Database schema is the design of a database.
  • A database constraint is a restriction on the type of data that can be inserted into a table.
  • Database schema and constraints are stored in the database catalog.
  • A database instance is the snapshot/state of a database at a particular time.
  • A query is a request to a database for information retrieval and data manipulation.
  • Data manipulation includes insertion, deletion and update.
  • The relational DBMS stores data in related tables.
  • Rows and columns of a table are called tuples and attributes respectively.
  • A table is called a relation.
  • Candidate Key, Primary Key, Composite Primary Key and Foreign Key are important keys.
  • Primary key uniquely identifies tuples in a relation.
  • Foreign key is used to relate two tables or relations.
  • Each column represents an attribute.
  • Each row represents a record or tuple.
  • Degree is the number of attributes in a relation.
  • Cardinality is the number of tuples in a relation.
  • SQL is identified in the chapter as the standard language for RDBMS systems such as MySQL.
verakworld.com

Questions & Answers

1-Mark Questions

1. What is a file?

A file is a container used to store data in a computer.

2. What is data redundancy?

Data redundancy means duplication of the same data in different places or files.

3. What is data inconsistency?

Data inconsistency occurs when the same data maintained in different places does not match.

4. What is DBMS?

DBMS is software used to create and manage databases.

5. What is database schema?

Database schema is the design or skeleton of a database representing its structure.

6. What is meta-data?

Meta-data is data about the data.

7. What is a database instance?

It is the state or snapshot of a database at any given time after data has been loaded.

8. What is a query?

A query is a request to a database for obtaining information in a desired way.

9. What is an attribute?

An attribute is a characteristic or parameter for which data is stored in a relation; it represents a column.

10. What is a tuple?

A tuple is a row of data in a relation.

11. What is degree?

Degree is the number of attributes in a relation.

12. What is cardinality?

Cardinality is the number of tuples in a relation.

13. What is a primary key?

A primary key is the candidate key selected to uniquely identify tuples in a relation.

14. What is a foreign key?

A foreign key is an attribute used to represent a relationship between two relations.

2-Mark Questions

1. State any two limitations of manual record keeping.

Any two are: repeated entry of student details in new registers, inconsistency due to incorrectly written or skipped records, loss of data if a register is lost/damaged, and erroneous manual calculations.

2. Explain data redundancy.

Data redundancy is duplication of the same data in different files or places. It causes excess storage usage and may lead to data inconsistency.

3. Explain data dependence.

Data dependence occurs when application programs depend on the structure or format of stored data. If the file structure changes, the programs accessing it also need modification.

4. What are the three data manipulation operations?

They are Insertion, Deletion and Update.

5. Differentiate degree and cardinality.
DegreeCardinality
Number of attributes in a relation.Number of tuples in a relation.
6. What is a composite primary key?

When no single attribute can uniquely distinguish tuples, more than one attribute is taken together as the primary key. Such a key is called a composite primary key.

3-Mark Questions

1. Explain any three limitations of a file system.

Difficulty in Access: Files do not provide a direct mechanism for retrieving data and application programs are required.

Data Redundancy: The same data may be duplicated in different files, increasing storage usage and possibly causing inconsistency.

Data Inconsistency: The same data in different places may not match if changes are not made in every file.

2. Explain candidate key and primary key.

A candidate key is an attribute capable of uniquely identifying tuples and is a candidate for primary key. The database designer selects one candidate key as the primary key. The remaining candidate keys become alternate keys.

3. Explain attribute, tuple, domain, degree and cardinality.

Attribute: A column or characteristic of a relation.
Tuple: A row in a relation.
Domain: Set of values from which an attribute can take values.
Degree: Number of attributes.
Cardinality: Number of tuples.

4/5-Mark Questions

1. Explain the limitations of a file system.

The limitations described in the chapter are Difficulty in Access, Data Redundancy, Data Inconsistency, Data Isolation, Data Dependence and Controlled Data Sharing. Each limitation makes storing, retrieving, maintaining or controlling data difficult as the amount of data grows.

2. Explain the conversion of the school file system into a database.

STUDENT and ATTENDANCE can be related through common fields. SName need not be repeated in ATTENDANCE. Guardian details can be separated into a GUARDIAN relation to reduce redundancy. GUID can be introduced to uniquely identify guardians and relate STUDENT and GUARDIAN.

3. Explain the different keys in a relational database.

Candidate Key, Primary Key, Alternate Key, Composite Primary Key and Foreign Key are described in the chapter. Candidate keys can uniquely identify tuples; one candidate key is selected as the primary key; remaining candidates are alternate keys; multiple attributes can form a composite primary key; and a foreign key connects related relations.

verakworld.com

📝 Important Questions

1 Mark

  1. Define file.
  2. What is data redundancy?
  3. What is data inconsistency?
  4. Define DBMS.
  5. What is a database schema?
  6. What is meta-data?
  7. Define database instance.
  8. What is a query?
  9. Define attribute.
  10. Define tuple.
  11. What is domain?
  12. Define degree and cardinality.
  13. What is a candidate key?
  14. What is a primary key?
  15. What is a foreign key?

2 Marks

  1. State the limitations of manual record keeping.
  2. Explain data redundancy.
  3. Explain data inconsistency.
  4. Explain data dependence.
  5. What are insertion, deletion and update?
  6. Differentiate degree and cardinality.
  7. What is a composite primary key?
  8. Why are constraints used in a database?

3 Marks

  1. Explain the limitations of a file system.
  2. Explain candidate key and primary key.
  3. Explain attribute, tuple and domain.
  4. Explain degree and cardinality with examples.
  5. Explain the three important properties of a relation.

4/5 Marks

  1. Explain how a file system can be converted into a DBMS-based database.
  2. Explain the important concepts in DBMS.
  3. Explain the relational data model and its terminology.
  4. Explain the different types of keys in a relational database.
  5. Explain the three important properties of a relation.
verakworld.com

Textbook Exercise — Chapter 8

1. Give the terms for each of the following

  1. Collection of logically related records.
  2. DBMS creates a file that contains description about the data stored in the database.
  3. Attribute that can uniquely identify the tuples in a relation.
  4. Special value stored when actual data value is unknown for an attribute.
  5. An attribute which can uniquely identify tuples of the table but is not defined as primary key.
  6. Software used to create, manipulate and maintain a relational database.

2.

Why are foreign keys allowed to have NULL values? Explain with an example.

3. Differentiate between

  1. Database state and database schema
  2. Primary key and foreign key
  3. Degree and cardinality of a relation

4.

Compared to a file system, how does a database management system avoid redundancy in data through a database?

5.

What are the limitations of file system that can be overcome by a relational DBMS?

6. Sports Preferences

Roll_noPreference
9Cricket
13Football
17Badminton
17Football
21Hockey
24NULL
NULLKabaddi
  1. Roll no 24 may not be interested in sports. Can a NULL value be assigned to that student’s preference field?
  2. Roll no 17 has given two preferences in sports. Which property of relational DBMS is violated? Can a constraint or key be used to check against such violation?
  3. Kabaddi was not chosen by any student. Is it possible to have this tuple in the Sports Preferences relation?

7. Sports Preferences of Two Sections

Section 1

Roll_noSports
9Cricket
13Football
17Badminton
21Hockey
24Cricket

Section 2

SportsRoll_no
Badminton17
Cricket9
Cricket24
Football13
Hockey21

Are the states of both relations equivalent? Justify.

8. School Canteen Database

The school canteen wants to maintain records of items available and generate bills when students purchase items. The database should track items and items purchased by students.

  1. To store each item name along with its price, what relation should be used? Decide appropriate attribute names and data types. Each item and its price should be stored only once. What restriction should be used?
  2. To generate a bill, quantity of an item purchased is required. Should this information be in a new relation or part of the previous relation? If a new relation is required, decide its name and data types and identify primary and foreign keys satisfying the given restrictions.
    1. The same bill cannot be generated for different orders.
    2. A bill can be generated only for available items in the canteen.
  3. The school wants to find how many calories students intake when they order an item. In which relation should the attribute calories be stored?

9. EMP-DEPENDENT Database

EMPLOYEE(AadharNumber, Name, Address, Department, EmployeeID) DEPENDENT(EmployeeID, DependentName, Relationship)
  1. Name the attributes of EMPLOYEE which can be used as candidate keys.
  2. The company wants to retrieve details of a dependent of a particular employee. Name the tables and key required to retrieve this detail.
  3. What is the degree of EMPLOYEE and DEPENDENT relation?

10. School Uniform Database

Attributes and Constraints

TableAttributeConstraints
UNIFORM UCode, UName, UColor Primary Key, Not Null, –
COST UCode, Size, Price Composite Primary Key, >0

UNIFORM

UCodeUNameUColor
1ShirtWhite
2PantGrey
3SkirtGrey
4TieBlue
5SocksBlue
6BeltBlue

COST

UCodeSizePrice
1M500
1L580
1XL620
2M810
2L890
2XL940
3M770
3L830
3XL910
4S150
4L170
5S180
5L210
6M110
6L140
6XL160
  1. Can the following tuples be inserted into UNIFORM? Give reasons:
    1. 7, Handkerchief, NULL
    2. 4, Ribbon, Red
    3. 8, NULL, White
  2. Can the following tuples be inserted into COST? Give reasons:
    1. 7, S, 0
    2. 9, XL, 100

11. Multiplex Database

Movie(Movie_ID, MovieName, ReleaseDate) Audi(AudiNo, Movie_ID, Seats, ScreenType, TicketPrice)
  1. Is it correct to assign Movie_ID as the primary key in MOVIE? If no, suggest an appropriate primary key.
  2. Is it correct to assign AudiNo as the primary key in AUDI? If no, suggest an appropriate primary key.
  3. Is there any foreign key in any of these relations?

12. STUDENT-PROJECT Database

Answer the following:

  1. Name the primary key of each table.
  2. Find foreign key(s) in PROJECT-ASSIGNED.
  3. Is there any alternate key in STUDENT? Give justification.
  4. Can a user assign duplicate value to RollNo of STUDENT? Justify.

PROJECT

ProjectNoPNameSubmissionDate
101Airline Database12/01/2018
102Library Database12/01/2018
103Employee Database15/01/2018
104Student Database12/01/2018
105Inventory Database15/01/2018
106Railway Database15/01/2018

PROJECT-ASSIGNED

Registration_IDProjectNo
IP-101-15101
IP-104-15103
CS-103-14102
CS-101-14105
CS-101-10104

STUDENT

Roll NoNameClassSectionRegistration_ID
11MohanXI1IP-101-15
12SohanXI2IP-104-15
21JohnXII1CS-103-14
22MeenaXII2CS-101-14
23JuhiXII2CS-101-10

13. STUDENT-PROJECT Database Operations

Can the following operations be performed?

  1. Insert a student record with missing roll number value.
  2. Insert a student record with missing registration number value.
  3. Insert a project detail without submission-date.
  4. Insert a record with registration ID IP-101-19 and ProjectNo 206 in PROJECT-ASSIGNED.
verakworld.com

⚡ Quick Revision

Important Definitions
  • File
  • DBMS
  • Database Schema
  • Data Constraint
  • Meta-data
  • Database Instance
  • Query
  • Attribute
  • Tuple
  • Domain
  • Degree
  • Cardinality
  • Candidate Key
  • Primary Key
  • Composite Primary Key
  • Foreign Key
File System Limitations
  • Difficulty in Access
  • Data Redundancy
  • Data Inconsistency
  • Data Isolation
  • Data Dependence
  • Controlled Data Sharing
Data Manipulation
  • Insertion
  • Deletion
  • Update
Relational Terms
  • Column = Attribute
  • Row = Tuple
  • Number of attributes = Degree
  • Number of tuples = Cardinality
  • Table = Relation
Keys
  • Candidate Key
  • Primary Key
  • Alternate Key
  • Composite Primary Key
  • Foreign Key
DBMS Examples
  • MySQL
  • Oracle
  • PostgreSQL
  • SQL Server
  • Microsoft Access
  • MongoDB

Important Comparison — Degree vs Cardinality

Basis Degree Cardinality
Meaning Number of attributes. Number of tuples.
Represents Columns. Rows.
GUARDIAN example 4 5

Important Comparison — Primary Key vs Foreign Key

Primary Key Foreign Key
Uniquely identifies tuples in a relation. Represents a relationship between two relations.
Selected from candidate keys. Refers to the primary key of another relation.
Defined in the primary/master relation. Present in the referencing/foreign relation.

Important Formulas / Structural Facts

Degree = Number of attributes in a relation

Cardinality = Number of tuples in a relation

GUARDIAN Degree = 4

GUARDIAN Cardinality = 5

Important Relation Schemas

STUDENT(RollNumber, SName, SDateofBirth, GUID) ATTENDANCE(AttendanceDate, RollNumber, AttendanceStatus) GUARDIAN(GUID, GName, GPhone, GAddress)

Important Composite Key

{RollNumber, AttendanceDate}

This combination forms the composite primary key of ATTENDANCE according to the chapter example.

Important Diagram to Revise

STUDENT
GUARDIAN
ATTENDANCE

Related data structure of the STUDENTATTENDANCE database.

verakworld.com

🎯 Final Revision

Remember These Points

  1. Manual record keeping becomes difficult as the volume of data increases.
  2. A file is a container for storing data.
  3. File systems have important limitations including redundancy, inconsistency, isolation and dependence.
  4. DBMS is software for creating and managing databases.
  5. DBMS provides an interface between users/application programs and databases.
  6. Database schema represents the design and structure of a database.
  7. Constraints restrict the type of data that can be inserted.
  8. Meta-data is data about data.
  9. Database instance is the state/snapshot of a database at a particular time.
  10. Query is a request for information from a database.
  11. Insertion, deletion and update are data manipulation operations.
  12. Relational model represents data through related tables called relations.
  13. Columns are attributes and rows are tuples.
  14. Degree counts attributes; cardinality counts tuples.
  15. Candidate keys can uniquely identify tuples.
  16. One candidate key is selected as the primary key.
  17. A candidate key not selected as primary key becomes an alternate key.
  18. More than one attribute together can form a composite primary key.
  19. A foreign key represents a relationship between relations.
  20. NULL represents an unknown or non-applicable value.
⭐ Board Exam Focus: Give special attention to the definitions, file-system limitations, DBMS concepts, relational terminology, properties of relations, candidate/primary/composite/foreign keys, relation schemas and the textbook exercise questions.
verakworld.com

2nd PUC / Class XII Computer Science — Chapter 8: Database Concepts

Complete Short Notes & Exam Preparation Guide

verakworld.com

Leave a Comment