Informatics Practices Chapter 7 4 Study Options Available

Database Concepts

CHAPTER PDF

Complete curriculum textbook chapter document for reading and offline study.

NOTES

Complete conceptual breakdown, formulas, diagrams, and memory aids.

Chapter 7 – Database Concepts | Class XI Informatics Practices
Informatics Practices · Class XI · Chapter 7

Database Concepts

Complete chapter notes covering file systems, DBMS, relational databases, relation properties and database keys—with clear explanations, examples, practical SQL illustrations and solved textbook exercises.

20-page source chapterConcepts + examplesRevision + exercise solutions

1. Introduction to Database Concepts

Data is an important resource. After collecting data, it must be stored, organised, updated and retrieved whenever required. A computerised system helps manage a large volume of information more efficiently than manual registers.

School attendance example

Imagine a school with 50 students and 26 working days in a month. The class teacher must record attendance for every student on every working day.

Number of attendance entries per month
50 students × 26 working days = 1,300 entries.

The office also maintains student details—Roll Number, Name and Date of Birth—and guardian details—Guardian Name, Contact Number and Address.

Problems with manual record keeping

  1. Student details must be entered again when a student is promoted to the next class.
  2. Repeated writing can cause spelling mistakes, skipped records and inconsistent information.
  3. Registers may be lost or damaged, resulting in data loss.
  4. Manual calculation while preparing attendance summaries may be incorrect.
  5. Searching, modifying or deleting a record in a large collection of paper registers is difficult.

What should a computerised system allow?

  • Copy student details to a new class attendance file.
  • Search student or guardian information.
  • Add details when a new student joins.
  • Modify student or guardian details when they change.
  • Delete records when a student leaves, subject to the organisation's record-retention rules.
Example: If a guardian changes their phone number, the school should update the stored number once and use the corrected value wherever that guardian's information is required.

2. File System

A file is a container used to store data in a computer. Files are stored on storage devices. A file may contain text, program code, comma-separated values (CSV), pictures, audio, video or web-page content.

Files can be opened directly, but when software must retrieve particular information from a file—for example, display a monthly attendance report—the developer generally needs to write an application program to read and process that file.

School example: two separate files

The school may maintain a STUDENT file for personal details and an ATTENDANCE file for daily attendance.

STUDENT file – fields and meaning

FieldMeaningExample value
RollNumberStudent's roll number1
SNameStudent's nameAtharv Ahuja
SDateofBirthStudent's date of birth2003-05-15
GNameGuardian's nameAmit Ahuja
GPhoneGuardian's phone number5711492685
GAddressGuardian's addressG-35, Ashok Vihar, Delhi

ATTENDANCE file – fields and meaning

FieldMeaningExample value
AttendanceDateDate on which attendance is marked2018-09-01
RollNumberRoll number of the student1
SNameName of the studentAtharv Ahuja
AttendanceStatusP = Present, A = AbsentP

Sample attendance records:

AttendanceDateRollNumberSNameAttendanceStatus
2018-09-011Atharv AhujaP
2018-09-012Daizy BhutiaP
2018-09-013Taleem ShahA
2018-09-021Atharv AhujaP
2018-09-024John DsouzaA
Remember: In the file-system example, student names occur in both files. Repeating the same information is one reason file-based data management becomes difficult as data grows.

3. Limitations of a File System

A file system becomes difficult to manage when the number of files and the volume of data increase. The chapter explains six major limitations.

3.1 Difficulty in Access

Files do not themselves provide a flexible mechanism for retrieving information in every required format. Data is accessed through application programs. If the developer did not anticipate a particular retrieval requirement, a new program may have to be written.

Example: A school wants a report of students who were absent on a particular date. If the existing program cannot produce this report, another program may be needed to read and process the attendance file.

3.2 Data Redundancy

Data redundancy means storing the same data more than once in different places or files. In the school example, student names are stored in both STUDENT and ATTENDANCE files. Guardian information may also be repeated for siblings.

  • Uses extra storage space.
  • Creates repeated work during data entry and updates.
  • May lead to data inconsistency.

3.3 Data Inconsistency

Data inconsistency occurs when the same data stored at different places does not match.

Example: A student's name is changed from “John Dsouza” to “John D'Souza”. If the change is made in the STUDENT file but not in the ATTENDANCE file, the two files show different names for the same student.

3.4 Data Isolation

Related data may be stored in separate files without a proper link or mapping. Different files may also have different formats and structures. It becomes difficult to combine information from them because the application must understand each file's structure.

Example: STUDENT and ATTENDANCE both contain student information, but a traditional file system does not automatically establish a relationship between the two files.

3.5 Data Dependence

Data in a file is stored in a particular structure or format. If that structure changes, the application programs that use the file may also need modification. This dependence of programs on the file structure is called data dependence.

Example: If a program expects three fields in a file and the file format is changed by inserting or rearranging fields, the old program may not read the file correctly until it is modified.

3.6 Controlled Data Sharing

Different users should have different permissions. A teacher may be allowed to update attendance, while guardians and office staff may only be allowed to view it. Enforcing such role-based access restrictions is difficult when files are accessed through separate application programs.

LimitationMeaning in one line
Difficulty in AccessRetrieving data in a required format may need a specially written program.
Data RedundancySame data is duplicated in multiple places.
Data InconsistencyCopies of the same data do not match.
Data IsolationRelated data is separated and difficult to combine.
Data DependenceChanging file structure may require changing application programs.
Controlled Data SharingGiving different users appropriate access rights is difficult.

4. Database Management System (DBMS)

A database stores logically related data in an organised manner. A Database Management System (DBMS) is software used to create and manage databases.

A DBMS allows users or application programs to create a database, store data, retrieve data, and insert, update or delete records. It acts as an interface between the database and its users or application programs.

End users
Application programs
↓
DBMS software
↓
Database + Database Catalog

Examples of DBMS

  • MySQL – widely used relational database management system.
  • Oracle Database – commercial database management system.
  • PostgreSQL – open-source relational database management system.
  • Microsoft SQL Server – commercial relational database management system.
  • Microsoft Access – database management software.
  • MongoDB – document-oriented database system.

Some DBMS products provide a graphical user interface (GUI). Others can be managed through a command-line interface (CLI), where users enter commands.

Querying a database

Retrieving information from a database by giving a request is called querying the database. A query can retrieve data or request a change to stored data.

Real-life applications of databases

ApplicationExamples of data maintained
BankingCustomer information, account details, loan details and transaction details.
Crop loanKisan Credit Card data, farmer details, land area, cultivation, loan history and repayments.
Inventory managementProduct details, customer information, orders and delivery data.
Organisation Resource ManagementEmployee records, salary details, departments and branch locations.
Online shoppingItem descriptions, user login details and user preferences.

Advantages of using a DBMS in the school example

  • Related information can be organised in tables.
  • Repeated data can be reduced by separating student, guardian and attendance information.
  • Data can be searched and retrieved through queries.
  • Multiple authorised users can work with a central database.
  • Data can be inserted, updated and deleted in a controlled manner.

Limitations of DBMS

  • Increased complexity: Managing security, consistency, sharing and integrity adds complexity.
  • Increased data vulnerability: Centralised data may be affected by hardware or software failure. A failure can interrupt operations for many users. Regular backup and recovery planning are therefore important.
Cost consideration: Moving from a file system to a DBMS may involve sophisticated hardware and software, user training and recurring costs for backups and recovery operations.

5. File System to DBMS – School Database Example

Suppose the school initially maintains STUDENT and ATTENDANCE files. To design a database, related tables are connected through common fields. The original files can be reorganised to reduce duplication and represent relationships clearly.

Changes required

  1. Remove repeated student name from ATTENDANCE. SName is already stored in STUDENT. The student name can be obtained using the common RollNumber field.
  2. Separate guardian details. If siblings share the same guardian, storing guardian details in every student record duplicates information. Create a separate GUARDIAN table.
  3. Introduce GUID (Guardian ID). Guardian names may not be unique. A unique GUID identifies each guardian. Store GUID in GUARDIAN and in STUDENT to connect the records.
Why not use the phone number as the guardian identifier? A phone number can change. A dedicated unique identifier such as GUID is a more stable way to identify a guardian.

Resulting table structures

TableFieldsPurpose
STUDENTRollNumber, SName, SDateofBirth, GUIDStores each student's details and the related guardian ID.
GUARDIANGUID, GName, GPhone, GAddressStores each guardian's details once.
ATTENDANCEAttendanceDate, RollNumber, AttendanceStatusStores the attendance status of a student on a date.

Sample STUDENT table

RollNumberSNameSDateofBirthGUID
1Atharv Ahuja2003-05-15444444444444
2Daizy Bhutia2002-02-28111111111111
3Taleem Shah2002-02-28101010101010
4John Dsouza2003-08-18333333333333
5Ali Shah2003-07-05101010101010
6Manika P.2002-03-10466444444666

Sample GUARDIAN table

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

Sample ATTENDANCE table

AttendanceDateRollNumberAttendanceStatus
2018-09-011P
2018-09-012P
2018-09-013A
2018-09-021P
2018-09-024A
Relationship overview
GUARDIAN
GUID (unique)
1 ← → many
STUDENT
GUID refers to guardian
1 ← → many
ATTENDANCE
RollNumber refers to student

One guardian may be associated with multiple students. One student may have multiple attendance records on different dates.

The database can be stored in a central location and accessed by multiple authorised users, such as teachers and office staff, at the same time.

6. Key Concepts in DBMS

6.1 Database Schema

A database schema is the design or structural description of a database. It describes table names, fields/columns, data types, constraints and relationships among tables. It is the skeleton or logical architecture of the database.

Example schema:
STUDENT(RollNumber, SName, SDateofBirth, GUID)
GUARDIAN(GUID, GName, GPhone, GAddress)

6.2 Data Constraint

A data constraint is a restriction placed on the values that may be entered into one or more columns. Constraints help maintain accuracy and reliability.

Examples:

  • RollNumber must not be empty.
  • RollNumber must be unique for every student.
  • A mobile number may be restricted to non-negative integer values of exactly ten digits, as in the textbook illustration.

6.3 Metadata or Data Dictionary

Metadata means data about data. The DBMS stores the database schema and its constraints in a database catalog or data dictionary. It describes the structure and rules of the stored data rather than being ordinary business records.

Example: Information that a table is named STUDENT, that RollNumber is an integer and that it is unique is metadata.

6.4 Database Instance (Database State)

A database schema initially defines an empty structure. After records are inserted, the contents of the database at a particular time are called the database instance or database state. The instance changes when records are inserted, updated or deleted. One schema can have many instances over time.

Example: The STUDENT table containing 30 students on Monday and 31 students after a new admission on Tuesday represents two different database instances of the same schema.

6.5 Query

A query is a request made to a database to obtain information in a desired way. A query may retrieve data from one table or combine information from multiple related tables. Query languages such as SQL are used to communicate with relational databases.

Example request: “Find the names of all students who were present on 2018-09-01.” This is a database query requirement.

6.6 Data Manipulation

Modification of database contents involves three basic operations:

  • Insertion: Adding a new record. Example: add a newly admitted student.
  • Deletion: Removing a record. Example: remove a student's record when permitted by the school's policy.
  • Update: Changing an existing value. Example: update a guardian's phone number.

6.7 Database Engine

The database engine is the underlying component or set of programs used by a DBMS to create databases and handle queries for data retrieval and manipulation.

TermMeaningEasy way to remember
SchemaDatabase design/structureBlueprint
ConstraintRule restricting data valuesValidation rule
MetadataData describing the database structureData about data
InstanceDatabase contents at a particular timeCurrent snapshot
QueryRequest for database information or actionQuestion/request
Data manipulationInsert, delete or update recordsChange data
Database engineCore component that processes database operationsProcessing core

7. Relational Data Model

A data model describes how data is structured and represented, how data items are related, and what constraints apply. The chapter mentions relational, object-oriented, entity-relationship, document and hierarchical data models.

In the relational data model, data is stored in tables. A table is called a relation. Each table contains columns and rows. Every column has a unique name, and each row represents a set of related values.

Relations are connected

Tables in a relational database are not isolated. Common fields and keys connect related records. In the school database:

  • ATTENDANCE.RollNumber refers to the matching student in STUDENT.
  • STUDENT.GUID refers to the matching guardian in GUARDIAN.

Without appropriate linking attributes, the DBMS cannot reliably connect the records to retrieve valid information.

Relation schemas in StudentAttendance

Relation schemaAttribute description
STUDENT(RollNumber, SName, SDateofBirth, GUID)RollNumber: student identifier; SName: student name; SDateofBirth: date of birth; GUID: guardian identifier.
ATTENDANCE(AttendanceDate, RollNumber, AttendanceStatus)AttendanceDate: date of attendance; RollNumber: student identifier; AttendanceStatus: P or A. The combination of date and roll number is unique.
GUARDIAN(GUID, GName, GPhone, GAddress)GUID: guardian identifier; GName: guardian name; GPhone: contact number; GAddress: address.
Important distinction: A relation is the table structure and its data in the relational model. A relation schema describes its attributes; a relation state/instance is the set of tuples present at a particular time.

8. Relational Data Model Terminology

Consider the following GUARDIAN relation:

GUIDGNameGPhoneGAddress
444444444444Amit Ahuja5711492685G-35, Ashok Vihar, Delhi
111111111111Baichung Bhutia3612967082Darjeeling Apartment, Shimla
101010101010Himanshu Shah4726309212West Patel Nagar, Ahmedabad
333333333333Danny DsouzaNULLAshok Village, Daman
466444444666Sujata P.3801923168Preet Vihar, Madurai

8.1 Attribute

An attribute is a characteristic or parameter for which data is stored in a relation. It is a column or field in a table.

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

8.2 Tuple

A tuple is a row in a relation. It contains related values for all the attributes of that record.

Example: The row containing GUID 444444444444, Amit Ahuja, 5711492685 and the Delhi address is one tuple.

8.3 Domain

A domain is the set of permitted values from which an attribute can take a value. A data type commonly specifies the domain.

  • RollNumber may have an integer domain.
  • SName may have a character-string domain.
  • AttendanceStatus may be restricted to P or A by an appropriate rule.

8.4 Degree

Degree is the number of attributes (columns) in a relation.

GUARDIAN has four attributes—GUID, GName, GPhone and GAddress. Therefore, its degree is 4.

8.5 Cardinality

Cardinality is the number of tuples (rows/records) in a relation.

The sample GUARDIAN relation has five rows. Therefore, its cardinality is 5.

Memory trick: Degree = columns. Cardinality = rows.
TermDatabase partExample in GUARDIANCount
AttributeColumnGUID, GName, GPhone, GAddress4 attributes
TupleRowOne guardian's complete recordOne tuple per row
DomainAllowed values for an attributeCharacter strings for GNameSet of permitted values
DegreeNumber of columns44
CardinalityNumber of rows55

9. Three Important Properties of a Relation

Property 1 – Rules about attributes (columns)

  • Each attribute in a relation must have a unique name.
  • The sequence/order of attributes is immaterial. Rearranging columns does not change the logical relation if their names and values remain correctly associated.

Property 2 – Rules about tuples (rows)

  • Each tuple must be distinct. No two tuples may have identical values for all attributes.
  • The sequence/order of tuples is immaterial. Sorting rows differently does not change the relation's logical contents.

Property 3 – Rules about the state of a relation

  1. Same domain in a column: All values in an attribute must belong to the same domain/data type.
  2. Atomic values: Each value should be indivisible into meaningful subparts for the purpose of the relation. For example, the textbook treats a ten-digit phone number as one atomic value.
  3. No multivalued cell: An attribute should not contain multiple values in one tuple. For example, do not store several guardian phone numbers together in one GPhone cell.
  4. NULL: NULL represents a value that is unknown or not applicable. For example, GPhone may be NULL if the guardian has not provided a phone number.
Example of atomic vs multiple values
Appropriate: GPhone = 9876543210
Not appropriate for a single-valued GPhone field: GPhone = 9876543210, 9123456780

Understanding NULL

NULL is not the same as zero, a blank string, or the word “NULL” typed as ordinary text. It indicates that a value is unknown, unavailable or not applicable. A NULL value does not mean that the value is zero.

Exam point: A relation may contain NULL in an attribute where it is permitted, but a primary-key attribute cannot be NULL. A foreign key may be NULL when it is not part of the primary key and the relationship is optional.

10. Keys in a Relational Database

Every tuple in a relation must be distinguishable. A key is an attribute or a set of attributes used to identify records and/or establish relationships between tables. The chapter explains four key types.

10.1 Candidate Key

A candidate key is an attribute, or a minimal set of attributes, that can uniquely identify each tuple in a relation. A relation may have more than one candidate key. Each candidate key is eligible to be selected as the primary key.

GUARDIAN example: If both GUID and GPhone contain unique values for every guardian, GUID and GPhone are candidate keys.

10.2 Primary Key

A primary key is the candidate key selected by the database designer to uniquely identify tuples in a relation. It must be unique and cannot contain NULL values.

GUARDIAN example: If GUID is selected as the primary key, GUID is the primary key and GPhone is an alternate key.

Alternate Key

Candidate keys that are not selected as the primary key are called alternate keys.

Candidate keys: GUID and GPhone. Selected primary key: GUID. Therefore, alternate key: GPhone.

10.3 Composite Primary Key

If no single attribute can uniquely identify each tuple, two or more attributes can be combined to form a composite primary key.

ATTENDANCE example:
  • RollNumber alone is not unique because the same student appears on multiple dates.
  • AttendanceDate alone is not unique because many students have attendance on the same date.
  • The combination (AttendanceDate, RollNumber) uniquely identifies one student's attendance record for one date.
Therefore, (AttendanceDate, RollNumber) is a composite primary key.

10.4 Foreign Key

A foreign key is an attribute in one relation whose values refer to the primary key of another relation. It represents a relationship between two tables.

  • The table containing the foreign key is the referencing/foreign relation.
  • The table whose primary key is being referenced is the referenced/primary/master relation.
  • A foreign key value must match an existing referenced key value, or be NULL where NULL is permitted.
StudentAttendance database:
  • STUDENT.GUID is a foreign key referencing GUARDIAN.GUID.
  • ATTENDANCE.RollNumber is a foreign key referencing STUDENT.RollNumber.
Key relationship diagram
GUARDIAN
PK: GUID
←
STUDENT
PK: RollNumber
FK: GUID
←
ATTENDANCE
PK: Date + RollNumber
FK: RollNumber

Comparison of all key types

Key typePurposeExample
Candidate KeyAny minimal unique identifier eligible to become primary key.GUID and GPhone in GUARDIAN (as stated in the textbook example).
Primary KeyChosen candidate key; uniquely identifies each row.GUID in GUARDIAN.
Alternate KeyCandidate key not selected as primary key.GPhone if GUID is selected.
Composite Primary KeyCombination of two or more attributes used as the primary key.(AttendanceDate, RollNumber).
Foreign KeyReferences a primary key in another table.STUDENT.GUID references GUARDIAN.GUID.
Important: A foreign key does not have to be unique. Many students can refer to the same guardian, and many attendance rows can refer to the same student. A foreign key can be NULL only when allowed by the table design and when it is not part of the primary key.

11. Practical SQL Syntax – Supporting Learning Examples

The source chapter introduces queries and SQL as the language used with relational databases, but it does not teach the detailed SQL command syntax in this chapter. The following are additional standard SQL illustrations to make the database concepts practical. SQL syntax can vary slightly between DBMS products.

11.1 CREATE TABLE – defining a table

CREATE TABLE Guardian (
    GUID       VARCHAR(12) PRIMARY KEY,
    GName      VARCHAR(60) NOT NULL,
    GPhone     CHAR(10) UNIQUE,
    GAddress   VARCHAR(150)
);

Explanation: CREATE TABLE creates a table. PRIMARY KEY identifies each guardian uniquely. NOT NULL requires a value. UNIQUE prevents duplicate phone numbers. VARCHAR stores variable-length text; CHAR stores fixed-length text.

11.2 Creating STUDENT with a foreign key

CREATE TABLE Student (
    RollNumber    INT PRIMARY KEY,
    SName         VARCHAR(60) NOT NULL,
    SDateofBirth  DATE,
    GUID          VARCHAR(12),
    FOREIGN KEY (GUID) REFERENCES Guardian(GUID)
);

Explanation: The GUID column in Student refers to GUID in Guardian. This establishes the relationship between the two tables.

11.3 Creating ATTENDANCE with a composite primary key

CREATE TABLE Attendance (
    AttendanceDate   DATE,
    RollNumber       INT,
    AttendanceStatus CHAR(1),
    PRIMARY KEY (AttendanceDate, RollNumber),
    FOREIGN KEY (RollNumber) REFERENCES Student(RollNumber)
);

The combination of AttendanceDate and RollNumber is the primary key. The same student can have attendance records on different dates, but cannot have two records for the same date under this design.

11.4 Inserting a record

INSERT INTO Guardian
    (GUID, GName, GPhone, GAddress)
VALUES
    ('444444444444', 'Amit Ahuja',
     '5711492685', 'Ashok Vihar, Delhi');

INSERT INTO adds a new row. The values must follow the listed column order when column names are supplied.

11.5 Retrieving records using SELECT

SELECT * FROM Student;

SELECT SName, RollNumber
FROM Student;

SELECT *
FROM Attendance
WHERE AttendanceDate = '2018-09-01'
  AND AttendanceStatus = 'P';

SELECT retrieves data. The asterisk (*) means all columns. WHERE filters rows according to a condition.

11.6 Updating a record

UPDATE Guardian
SET GPhone = '9876543210'
WHERE GUID = '444444444444';

UPDATE changes existing data. The WHERE clause is essential to target the intended record; without it, every row may be updated.

11.7 Deleting a record

DELETE FROM Guardian
WHERE GUID = '444444444444';

DELETE removes matching rows. A referenced guardian may not be deletable while student records still refer to that guardian, depending on the foreign-key rules configured.

11.8 Useful constraint keywords

SQL keywordMeaningIllustration
PRIMARY KEYUnique identifier; cannot be NULL.RollNumber INT PRIMARY KEY
FOREIGN KEYLinks to a key in another table.FOREIGN KEY (GUID) REFERENCES Guardian(GUID)
UNIQUEPrevents duplicate values.GPhone CHAR(10) UNIQUE
NOT NULLRequires a value.GName VARCHAR(60) NOT NULL
CHECKRequires a condition to be true.CHECK (AttendanceStatus IN ('P','A'))

11.9 Adding a CHECK constraint (illustration)

CREATE TABLE AttendanceExample (
    AttendanceDate DATE,
    RollNumber INT,
    AttendanceStatus CHAR(1)
        CHECK (AttendanceStatus IN ('P', 'A')),
    PRIMARY KEY (AttendanceDate, RollNumber)
);
SQL note: These statements are teaching examples. Exact data types, identifier rules and supported constraint behaviour may differ across MySQL, PostgreSQL, Oracle and SQL Server. The conceptual meaning of the keys and constraints remains the focus here.

12. Complete Chapter Summary

  1. A file is a container used to store data in a computer.
  2. File systems face limitations such as difficulty in access, redundancy, inconsistency, isolation, dependence and difficulty in controlled sharing.
  3. A DBMS is software used to create and manage databases.
  4. A database is an organised collection of logically related data; in a relational database, data is stored in related tables.
  5. A database schema describes the database structure.
  6. A constraint is a restriction on the values that can be stored.
  7. Schema and constraints are recorded in the database catalog/data dictionary as metadata.
  8. The database instance is the snapshot of database contents at a particular time.
  9. A query is a request to retrieve information or manipulate data.
  10. The basic data-manipulation operations are insertion, deletion and update.
  11. A database engine processes database operations and queries.
  12. In a relational model, a table is a relation, a column is an attribute and a row is a tuple.
  13. Domain means the permitted set of values for an attribute.
  14. Degree is the number of attributes; cardinality is the number of tuples.
  15. Relation attributes have unique names; row and column order are immaterial.
  16. Tuples must be distinct; values in an attribute must come from the same domain and be atomic. NULL represents unknown or non-applicable information.
  17. A candidate key can uniquely identify tuples; one candidate key is selected as the primary key.
  18. A candidate key not selected as primary key is an alternate key.
  19. A composite primary key contains more than one attribute.
  20. A foreign key refers to a primary key in another relation and connects tables.
  21. SQL is a standard language used to work with relational database systems such as MySQL.

13. Solved Textbook Exercises

The following answers address the exercise questions included in the uploaded chapter. Explanations are included so that students understand the reasoning, not just the final term.

Q1. Give the terms for each description.
  1. Collection of logically related records – Database.
  2. File containing description about data stored in the database – Data dictionary / database catalog (metadata).
  3. Attribute that can uniquely identify tuples – Candidate key.
  4. Special value used when the actual value is unknown – NULL.
  5. Unique attribute not selected as the primary key – Alternate key.
  6. Software used to create, manipulate and maintain a relational database – RDBMS (Relational Database Management System).
Q2. Why are foreign keys allowed to have NULL values? Explain with an example.

A foreign key may be NULL when the relationship is optional or the related record is not yet known, provided that the foreign-key column is not part of the primary key and the table definition permits NULL. For example, a STUDENT record may temporarily have GUID = NULL if guardian details have not yet been provided. A non-NULL foreign-key value must refer to an existing key in the referenced table.

Q3. Differentiate between (a) database state and schema, (b) primary key and foreign key, (c) degree and cardinality.
BasisFirst termSecond term
(a)Schema: design/structure of the database; changes relatively rarely.State/instance: actual data snapshot at a particular time; changes when data is inserted, updated or deleted.
(b)Primary key: uniquely identifies each row in its own table; cannot be NULL.Foreign key: refers to a key in another table to establish a relationship; may be NULL if permitted.
(c)Degree: number of columns/attributes.Cardinality: number of rows/tuples.
Q4. Compared with a file system, how does a DBMS avoid data redundancy?

A DBMS organises logically related data into separate related tables and links them through keys. For example, guardian details are stored once in GUARDIAN. STUDENT stores only GUID to refer to the guardian, rather than repeating the guardian's name, phone and address for every sibling. This reduces unnecessary duplication.

Q5. What file-system limitations can be overcome by a relational DBMS?

A relational DBMS helps address difficulty in data access, data redundancy, data inconsistency, data isolation, data dependence and controlled data sharing through structured tables, relationships, queries, constraints and access-control facilities. The extent of each benefit depends on correct database design and configuration.

Q6. Sports Preferences table – answer parts (a), (b) and (c).

Given records include Roll_no 9–Cricket, 13–Football, 17–Badminton, 17–Football, 21–Hockey, 24–NULL and NULL–Kabaddi.

  1. Can Roll_no 24 have NULL Preference? If the school rule requires every student to select one sport, NULL is not appropriate because it means the preference is unknown or not applicable. A NOT NULL constraint should be used on Preference to enforce a required value.
  2. Roll_no 17 has two preferences. If each student must have only one preference, Roll_no should be unique in this relation. A primary key or UNIQUE constraint on Roll_no would prevent two rows for the same student. The duplicate violates the intended uniqueness rule for one preference per student.
  3. Can NULL–Kabaddi be stored? No, not if Roll_no is the primary key, because a primary key cannot be NULL. The fact that no student chose Kabaddi does not require a row with a NULL roll number.
Q7. Are the states of the two Sports Preferences relations equivalent?

Yes. The same five student–sport pairings appear in both tables. The second relation is displayed in a different row order and with the columns in a different order. In a relation, the order of tuples and the order of attributes are immaterial, provided the attribute names and their corresponding values represent the same information.

Q8. Design a database for the school canteen.

(a) Item relation: Create an ITEM table with ItemID, ItemName and Price. ItemID should be a primary key; ItemName may also be UNIQUE if the business rule says item names cannot repeat. Store each item's name and price once.

ITEM(ItemID, ItemName, Price)
Primary key: ItemID

(b) Purchase/bill relation: Store transaction-specific quantity in a separate BILL_ITEM table, not in ITEM, because the quantity purchased changes from one order to another. A suitable design is:

BILL(BillID, BillDate, StudentID)
Primary key: BillID

BILL_ITEM(BillID, ItemID, Quantity)
Composite primary key: (BillID, ItemID)
Foreign key: BillID references BILL(BillID)
Foreign key: ItemID references ITEM(ItemID)

BillID uniquely identifies a bill. ItemID ensures that a purchased item must exist in ITEM. The composite key prevents the same item from being entered twice on the same bill; multiple items can appear on one bill. If the school permits repeated lines for the same item, a separate BillLineID can be used instead.

(c) Calories: Store calories in ITEM if calories are an inherent property of each item and do not vary by order. If calories depend on portion size or recipe version, the design would need to represent that separately.

Q9. EMPLOYEE and DEPENDENT database.

Given:

EMPLOYEE(AadharNumber, Name, Address, Department, EmployeeID)
DEPENDENT(EmployeeID, DependentName, Relationship)
  1. Candidate keys in EMPLOYEE: AadharNumber and EmployeeID, assuming each is unique and non-NULL as intended by the design.
  2. Retrieve dependents of an employee: Use EMPLOYEE and DEPENDENT, linked by EmployeeID. EmployeeID is the primary key in EMPLOYEE and a foreign key in DEPENDENT. A join on EmployeeID retrieves the employee's dependents.
  3. Degree: EMPLOYEE has 5 attributes; DEPENDENT has 3 attributes.
SELECT E.Name, D.DependentName, D.Relationship
FROM EMPLOYEE AS E
JOIN DEPENDENT AS D
  ON E.EmployeeID = D.EmployeeID;
Q10. SCHOOL_UNIFORM database – determine whether tuples can be inserted.

UNIFORM has attributes UCode, UName, UColor with UCode as primary key and UName NOT NULL. COST has UCode, Size, Price; (UCode, Size) is the composite primary key and Price must be greater than 0. COST.UCode is understood to refer to a valid uniform code.

(a) UNIFORM:

  1. (7, Handkerchief, NULL) – Allowed under the stated constraints: UCode 7 is new, UName is supplied, and no NOT NULL rule is shown for UColor.
  2. (4, Ribbon, Red) – Not allowed: UCode 4 already exists and UCode is the primary key.
  3. (8, NULL, White) – Not allowed: UName is NOT NULL.

(b) COST:

  1. (7, S, 0) – Not allowed: Price must be greater than 0.
  2. (9, XL, 100) – Allowed under the constraints explicitly shown in the textbook diagram: the (UCode, Size) combination is new and Price is greater than 0. The diagram does not explicitly list a foreign-key constraint on COST.UCode. If a foreign key to UNIFORM.UCode were additionally defined, this row would be rejected because UCode 9 is not present in UNIFORM.
Q11. MOVIE and AUDI relations – identify appropriate keys.

Given MOVIE(Movie_ID, MovieName, ReleaseDate) and AUDI(AudiNo, Movie_ID, Seats, ScreenType, TicketPrice). One movie can be screened in more than one auditorium.

  1. MOVIE: Movie_ID is an appropriate primary key if each movie has a unique Movie_ID.
  2. AUDI: AudiNo can be the primary key if it uniquely identifies each auditorium in the multiplex. Movie_ID should not be the primary key of AUDI because the same movie may be shown in multiple auditoriums and therefore Movie_ID can repeat in AUDI.
  3. Foreign key: AUDI.Movie_ID references MOVIE.Movie_ID.
Q12. STUDENT–PROJECT database – identify keys.

From the given tables:

  • STUDENT(RollNo, Name, Class, Section, Registration_ID)
  • PROJECT(ProjectNo, PName, SubmissionDate)
  • PROJECT_ASSIGNED(Registration_ID, ProjectNo)
  1. Primary keys: STUDENT – RollNo; PROJECT – ProjectNo; PROJECT_ASSIGNED – composite key (Registration_ID, ProjectNo), assuming each student may be assigned a project and the pair is unique.
  2. Foreign keys in PROJECT_ASSIGNED: Registration_ID references STUDENT.Registration_ID; ProjectNo references PROJECT.ProjectNo.
  3. Alternate key in STUDENT: Registration_ID is an alternate key if it is unique and RollNo is selected as the primary key.
  4. Can RollNo be duplicated? No. RollNo is the primary key and must uniquely identify every student.
Q13. Can the listed operations be performed in STUDENT–PROJECT?
  1. Insert student with missing RollNo: No. RollNo is the primary key and cannot be NULL.
  2. Insert student with missing Registration_ID: No, if Registration_ID is defined as an alternate key/UNIQUE and NOT NULL as required for a candidate key. The displayed schema identifies it as a unique student registration identifier; it must be supplied for that design.
  3. Insert project without SubmissionDate: It depends on the constraint. The supplied chapter diagram does not show a NOT NULL constraint for SubmissionDate. If no NOT NULL constraint is defined, the date may be NULL; otherwise it cannot.
  4. Insert PROJECT_ASSIGNED record (IP-101-19, 206): No, if both columns are foreign keys, because Registration_ID IP-101-19 is not present in STUDENT and ProjectNo 206 is not present in PROJECT. Both references must point to existing records.

14. Quick Revision – Important Examination Points

  • File: container for storing data.
  • DBMS: software to create and manage databases.
  • RDBMS: DBMS based on related tables/relations.
  • Redundancy: unnecessary duplication of data.
  • Inconsistency: conflicting copies of the same data.
  • Schema: database design.
  • Instance: database snapshot at a given time.
  • Metadata: data about data.
  • Attribute: column.
  • Tuple: row.
  • Domain: allowed set of values for an attribute.
  • Degree: number of columns.
  • Cardinality: number of rows.
  • Candidate key: minimal unique identifier candidate.
  • Primary key: selected candidate key.
  • Alternate key: candidate key not selected as primary key.
  • Composite primary key: primary key made from multiple attributes.
  • Foreign key: attribute(s) referencing a key in another table.
  • NULL: unknown or non-applicable value; not the same as zero.
  • Data manipulation: INSERT, DELETE and UPDATE operations.

Common mistakes to avoid

  1. Do not confuse degree with cardinality: degree counts columns; cardinality counts rows.
  2. Do not confuse schema with instance: schema is structure; instance is current data.
  3. Do not assume a foreign key must be unique. Multiple rows may refer to the same parent row.
  4. Do not use a name as a primary key unless uniqueness and non-NULL requirements are guaranteed.
  5. Do not treat NULL as zero or an empty string.
  6. Do not store multiple values in one attribute cell in a properly designed relation.
  7. Remember that a composite key is a combination of attributes, not merely any two columns.
Study suggestion: Practise identifying the primary key, foreign key, degree and cardinality from a small table. These concepts are easiest to master by examining actual table structures.
Class XI Informatics Practices · Chapter 7: Database Concepts
Prepared as structured study notes from the uploaded chapter, with clearly labelled supplementary SQL examples.

TEXTBOOK SOLUTION

Step-by-step solved textbook exercises, derivations, and solutions.

13. Solved Textbook Exercises – Database Concepts

13. Solved Textbook Exercises

The following answers address the exercise questions included in the uploaded chapter. Explanations are included so that students understand the reasoning, not just the final term.

Q1. Give the terms for each description.
  1. Collection of logically related records – Database.
  2. File containing description about data stored in the database – Data dictionary / database catalog (metadata).
  3. Attribute that can uniquely identify tuples – Candidate key.
  4. Special value used when the actual value is unknown – NULL.
  5. Unique attribute not selected as the primary key – Alternate key.
  6. Software used to create, manipulate and maintain a relational database – RDBMS (Relational Database Management System).
Q2. Why are foreign keys allowed to have NULL values? Explain with an example.

A foreign key may be NULL when the relationship is optional or the related record is not yet known, provided that the foreign-key column is not part of the primary key and the table definition permits NULL. For example, a STUDENT record may temporarily have GUID = NULL if guardian details have not yet been provided. A non-NULL foreign-key value must refer to an existing key in the referenced table.

Q3. Differentiate between (a) database state and schema, (b) primary key and foreign key, (c) degree and cardinality.
BasisFirst termSecond term
(a)Schema: design/structure of the database; changes relatively rarely.State/instance: actual data snapshot at a particular time; changes when data is inserted, updated or deleted.
(b)Primary key: uniquely identifies each row in its own table; cannot be NULL.Foreign key: refers to a key in another table to establish a relationship; may be NULL if permitted.
(c)Degree: number of columns/attributes.Cardinality: number of rows/tuples.
Q4. Compared with a file system, how does a DBMS avoid data redundancy?

A DBMS organises logically related data into separate related tables and links them through keys. For example, guardian details are stored once in GUARDIAN. STUDENT stores only GUID to refer to the guardian, rather than repeating the guardian's name, phone and address for every sibling. This reduces unnecessary duplication.

Q5. What file-system limitations can be overcome by a relational DBMS?

A relational DBMS helps address difficulty in data access, data redundancy, data inconsistency, data isolation, data dependence and controlled data sharing through structured tables, relationships, queries, constraints and access-control facilities. The extent of each benefit depends on correct database design and configuration.

Q6. Sports Preferences table – answer parts (a), (b) and (c).

Given records include Roll_no 9–Cricket, 13–Football, 17–Badminton, 17–Football, 21–Hockey, 24–NULL and NULL–Kabaddi.

  1. Can Roll_no 24 have NULL Preference? If the school rule requires every student to select one sport, NULL is not appropriate because it means the preference is unknown or not applicable. A NOT NULL constraint should be used on Preference to enforce a required value.
  2. Roll_no 17 has two preferences. If each student must have only one preference, Roll_no should be unique in this relation. A primary key or UNIQUE constraint on Roll_no would prevent two rows for the same student. The duplicate violates the intended uniqueness rule for one preference per student.
  3. Can NULL–Kabaddi be stored? No, not if Roll_no is the primary key, because a primary key cannot be NULL. The fact that no student chose Kabaddi does not require a row with a NULL roll number.
Q7. Are the states of the two Sports Preferences relations equivalent?

Yes. The same five student–sport pairings appear in both tables. The second relation is displayed in a different row order and with the columns in a different order. In a relation, the order of tuples and the order of attributes are immaterial, provided the attribute names and their corresponding values represent the same information.

Q8. Design a database for the school canteen.

(a) Item relation: Create an ITEM table with ItemID, ItemName and Price. ItemID should be a primary key; ItemName may also be UNIQUE if the business rule says item names cannot repeat. Store each item's name and price once.

ITEM(ItemID, ItemName, Price)
Primary key: ItemID

(b) Purchase/bill relation: Store transaction-specific quantity in a separate BILL_ITEM table, not in ITEM, because the quantity purchased changes from one order to another. A suitable design is:

BILL(BillID, BillDate, StudentID)
Primary key: BillID

BILL_ITEM(BillID, ItemID, Quantity)
Composite primary key: (BillID, ItemID)
Foreign key: BillID references BILL(BillID)
Foreign key: ItemID references ITEM(ItemID)

BillID uniquely identifies a bill. ItemID ensures that a purchased item must exist in ITEM. The composite key prevents the same item from being entered twice on the same bill; multiple items can appear on one bill. If the school permits repeated lines for the same item, a separate BillLineID can be used instead.

(c) Calories: Store calories in ITEM if calories are an inherent property of each item and do not vary by order. If calories depend on portion size or recipe version, the design would need to represent that separately.

Q9. EMPLOYEE and DEPENDENT database.

Given:

EMPLOYEE(AadharNumber, Name, Address, Department, EmployeeID)
DEPENDENT(EmployeeID, DependentName, Relationship)
  1. Candidate keys in EMPLOYEE: AadharNumber and EmployeeID, assuming each is unique and non-NULL as intended by the design.
  2. Retrieve dependents of an employee: Use EMPLOYEE and DEPENDENT, linked by EmployeeID. EmployeeID is the primary key in EMPLOYEE and a foreign key in DEPENDENT. A join on EmployeeID retrieves the employee's dependents.
  3. Degree: EMPLOYEE has 5 attributes; DEPENDENT has 3 attributes.
SELECT E.Name, D.DependentName, D.Relationship
FROM EMPLOYEE AS E
JOIN DEPENDENT AS D
  ON E.EmployeeID = D.EmployeeID;
Q10. SCHOOL_UNIFORM database – determine whether tuples can be inserted.

UNIFORM has attributes UCode, UName, UColor with UCode as primary key and UName NOT NULL. COST has UCode, Size, Price; (UCode, Size) is the composite primary key and Price must be greater than 0. COST.UCode is understood to refer to a valid uniform code.

(a) UNIFORM:

  1. (7, Handkerchief, NULL) – Allowed under the stated constraints: UCode 7 is new, UName is supplied, and no NOT NULL rule is shown for UColor.
  2. (4, Ribbon, Red) – Not allowed: UCode 4 already exists and UCode is the primary key.
  3. (8, NULL, White) – Not allowed: UName is NOT NULL.

(b) COST:

  1. (7, S, 0) – Not allowed: Price must be greater than 0.
  2. (9, XL, 100) – Allowed under the constraints explicitly shown in the textbook diagram: the (UCode, Size) combination is new and Price is greater than 0. The diagram does not explicitly list a foreign-key constraint on COST.UCode. If a foreign key to UNIFORM.UCode were additionally defined, this row would be rejected because UCode 9 is not present in UNIFORM.
Q11. MOVIE and AUDI relations – identify appropriate keys.

Given MOVIE(Movie_ID, MovieName, ReleaseDate) and AUDI(AudiNo, Movie_ID, Seats, ScreenType, TicketPrice). One movie can be screened in more than one auditorium.

  1. MOVIE: Movie_ID is an appropriate primary key if each movie has a unique Movie_ID.
  2. AUDI: AudiNo can be the primary key if it uniquely identifies each auditorium in the multiplex. Movie_ID should not be the primary key of AUDI because the same movie may be shown in multiple auditoriums and therefore Movie_ID can repeat in AUDI.
  3. Foreign key: AUDI.Movie_ID references MOVIE.Movie_ID.
Q12. STUDENT–PROJECT database – identify keys.

From the given tables:

  • STUDENT(RollNo, Name, Class, Section, Registration_ID)
  • PROJECT(ProjectNo, PName, SubmissionDate)
  • PROJECT_ASSIGNED(Registration_ID, ProjectNo)
  1. Primary keys: STUDENT – RollNo; PROJECT – ProjectNo; PROJECT_ASSIGNED – composite key (Registration_ID, ProjectNo), assuming each student may be assigned a project and the pair is unique.
  2. Foreign keys in PROJECT_ASSIGNED: Registration_ID references STUDENT.Registration_ID; ProjectNo references PROJECT.ProjectNo.
  3. Alternate key in STUDENT: Registration_ID is an alternate key if it is unique and RollNo is selected as the primary key.
  4. Can RollNo be duplicated? No. RollNo is the primary key and must uniquely identify every student.
Q13. Can the listed operations be performed in STUDENT–PROJECT?
  1. Insert student with missing RollNo: No. RollNo is the primary key and cannot be NULL.
  2. Insert student with missing Registration_ID: No, if Registration_ID is defined as an alternate key/UNIQUE and NOT NULL as required for a candidate key. The displayed schema identifies it as a unique student registration identifier; it must be supplied for that design.
  3. Insert project without SubmissionDate: It depends on the constraint. The supplied chapter diagram does not show a NOT NULL constraint for SubmissionDate. If no NOT NULL constraint is defined, the date may be NULL; otherwise it cannot.
  4. Insert PROJECT_ASSIGNED record (IP-101-19, 206): No, if both columns are foreign keys, because Registration_ID IP-101-19 is not present in STUDENT and ProjectNo 206 is not present in PROJECT. Both references must point to existing records.

MCQ

High-yield board questions, previous year questions (PYQs), and model answer keys.

Database Concepts – 50 MCQ Practice Test
Computer Science • MCQ Practice

Database Concepts – 50 MCQ Practice Test

Practice questions covering file systems, DBMS, database structure, relational data models and keys. Select one answer for each question, submit your test and review the explanations.

50Total Questions
5Sections
1Mark per Question
0 / 50Answered

Test Result

0 / 50

Correct: 0   |   Incorrect: 0   |   Unanswered: 0

Database Concepts MCQ Practice • Use Reset Test to attempt the questions again.