Current Affairs updated daily
KalviGavaniKalviGavani
Class 12 · Tamil Nadu State Board

Samacheer Kalvi 12th Computer Science Chapter 11 Database Concepts Exercise Solutions | KalviGavani

Complete TN State Board Class 12 Computer Science Chapter 11 Database Concepts exercise solutions — DBMS, relational model, tables, keys (primary, foreign, candidate, super, alternate), relational algebra (select, project, join), normalisation (1NF, 2NF, 3NF), constraints with examples.

Updated 13 June 202615 min read

How to Use This Page

1. Attempt every exercise on your own before reading the solution. 2. Compare your approach with the solution — focus on the logic, not just the final answer. 3. Review the Common Mistakes section to avoid errors that cost marks in exams.


Key Concepts

Database and DBMS

ConceptDefinition
DatabaseOrganised collection of related data stored together
DBMSSoftware that manages creation, manipulation, and retrieval of databases
Relational ModelData organised as tables (relations) with rows (tuples) and columns (attributes)
Table / RelationA set of rows and columns; each row is a record
TupleA single row in a table (one record)
AttributeA single column in a table (one field)
SchemaStructure/blueprint of a database (table names, columns, types)
InstanceThe actual data in the database at a given time

Types of Keys

Key TypeDefinitionExample
Super KeyAny set of attributes that uniquely identifies a tuple{RollNo}, {RollNo, Name}
Candidate KeyA minimal super key (no redundant attribute){RollNo}, {Email}
Primary KeyThe candidate key chosen to identify tuplesRollNo
Alternate KeyCandidate keys not selected as primary keyEmail
Foreign KeyAn attribute in one table referencing the primary key of another tableDeptID in Employee table

Relational Algebra

OperationSymbolDescriptionExample
SelectσFilters rows by conditionσ_(age>20)(Student)
ProjectπSelects specific columnsπ_(name,age)(Student)
Join⋈Combines rows from two tablesStudent ⋈_(Student.dept=Dept.id) Dept

Normalisation Forms

Normal FormRule
1NFEvery attribute must have atomic (indivisible) values; no repeating groups
2NFMust be in 1NF + no partial dependency on a composite primary key
3NFMust be in 2NF + no transitive dependency (non-key depends only on primary key)

Multiple Choice Questions (MCQs)

Q1. A DBMS is:

  • (a) A hardware device for storing data
  • (b) Software for managing databases
  • (c) A programming language
  • (d) A type of network
Answer(b) A DBMS (Database Management System) is software that allows users to create, read, update, and delete data in a database.

Q2. Which key uniquely identifies each record in a table and cannot be null?

  • (a) Foreign key
  • (b) Candidate key
  • (c) Primary key
  • (d) Super key
Answer(c) A primary key uniquely identifies each record and must be unique and not null.

Q3. In relational algebra, the symbol σ (sigma) represents:

  • (a) Project operation
  • (b) Select operation
  • (c) Join operation
  • (d) Union operation
Answer(b) σ (sigma) is the Select operation that filters rows based on a condition.

Q4. A table is in 2NF if it is in 1NF and:

  • (a) It has no foreign keys
  • (b) It has no partial dependencies
  • (c) It has no transitive dependencies
  • (d) It has no duplicate rows
Answer(b) 2NF requires 1NF plus the elimination of partial dependencies (non-key attributes must depend on the entire primary key, not just part of it).

Q5. Which of the following is a transitive dependency?

  • (a) RollNo → Name
  • (b) RollNo → DeptID → DeptName
  • (c) (RollNo, Subject) → Marks
  • (d) EmpID → Salary
Answer(b) A transitive dependency occurs when a non-key attribute depends on another non-key attribute: RollNo → DeptID and DeptID → DeptName, so DeptName transitively depends on RollNo through DeptID.

Fill in the Blanks

Q1. A ______ is a minimal super key.

AnswerCandidate key

Q2. The ______ operation in relational algebra selects specific columns from a table.

AnswerProject (π)

Q3. In 1NF, every attribute must contain ______ values.

Answeratomic (indivisible)

Q4. A ______ key in one table refers to the primary key of another table.

AnswerForeign

Q5. The process of organising data to reduce redundancy is called ______.

AnswerNormalisation

True or False

Q1. A super key can contain redundant attributes.

AnswerTrue — A super key is any set of attributes that uniquely identifies a tuple; it may contain extra attributes. A candidate key is a minimal super key.

Q2. A foreign key can have null values.

AnswerTrue — A foreign key can be null if the relationship is optional. However, if the relationship is mandatory, it must reference a valid primary key value.

Q3. A table in 3NF is automatically in 2NF.

AnswerTrue — 3NF requires 2NF, which requires 1NF. So 3NF implies 2NF.

Q4. The Project operation in relational algebra can produce duplicate rows.

AnswerTrue — Projecting specific columns may produce duplicate rows. In formal relational algebra, duplicates are removed, but in SQL they may remain unless DISTINCT is used.

Q5. In a relational model, data is stored as objects.

AnswerFalse — In a relational model, data is stored as tables (relations) with rows (tuples) and columns (attributes), not as objects.

Match the Following

Column AColumn B
1. Primary Key(a) Removes transitive dependency
2. Foreign Key(b) Filters rows by condition
3. Select (σ)(c) Uniquely identifies each tuple
4. Project (π)(d) References primary key of another table
5. 3NF(e) Selects specific columns
Answer1-c, 2-d, 3-b, 4-e, 5-a

Short Answer Questions

Q1. What is a DBMS? Give two examples.

A Database Management System (DBMS) is software that enables users to create, manage, and manipulate databases. It provides tools for storing, retrieving, updating, and deleting data efficiently while ensuring data integrity and security.

Examples: MySQL, PostgreSQL, Oracle, Microsoft SQL Server, SQLite.

Advantages of DBMS:

  • Reduces data redundancy
  • Ensures data consistency
  • Provides data security and access control
  • Supports concurrent access by multiple users
  • Enables backup and recovery

Q2. Differentiate between primary key and candidate key.

FeaturePrimary KeyCandidate Key
DefinitionChosen candidate key to identify recordsAny minimal set of attributes that uniquely identifies a record
Number per tableOnly oneCan be multiple
Null valuesNot allowedNot allowed
SelectionDesigner selects one from candidate keysAll minimal super keys are candidate keys

Example: In a Student table, both RollNo and Email can uniquely identify a student. Both are candidate keys. The designer chooses RollNo as the primary key, making Email an alternate key.

Q3. What is a foreign key? Give an example.

A foreign key is an attribute (or set of attributes) in one table that refers to the primary key of another table. It establishes a relationship between two tables.

Example:

Department Table:

DeptID (PK)DeptName
D01Computer Science
D02Physics

Employee Table:

EmpID (PK)EmpNameDeptID (FK)
E1ArunD01
E2BalaD02

The DeptID in Employee is a foreign key referencing DeptID in Department. This ensures every employee belongs to a valid department.

Q4. Explain the Select (σ) operation with an example.

The Select operation filters rows from a table based on a condition. It returns all tuples that satisfy the given condition.

Symbol: σ (sigma)

Syntax: σ_condition(Relation)

Example: Given Student table:

RollNoNameMarks
101Arun85
102Bala72
103Chitra90
104Deepa65

Query: σ_(Marks>75)(Student)

Result
RollNoNameMarks
101Arun85
103Chitra90

Q5. Explain the Project (π) operation with an example.

The Project operation selects specific columns from a table, eliminating duplicates in the result.

Symbol: π (pi)

Syntax: π_column_list(Relation)

Example: Using the Student table above:

Query: π_(Name, Marks)(Student)

Result
NameMarks
Arun85
Bala72
Chitra90
Deepa65

Detailed Answers

Q1. Explain all types of keys in a database with examples.

Consider a Student table:

RollNoRegNoNameEmailDeptID
101R2024001Arun[email protected]D01
102R2024002Bala[email protected]D02

(a) Super Key

Any combination of attributes that uniquely identifies a tuple.

  • {RollNo}
  • {RollNo, Name}
  • {RollNo, RegNo}
  • {Email}
  • {RegNo, Email}

All of these are super keys because each can uniquely identify a row.

(b) Candidate Key

A minimal super key — removing any attribute would make it non-unique.

  • {RollNo} — minimal
  • {RegNo} — minimal
  • {Email} — minimal

These are candidate keys because they are the smallest sets that still uniquely identify a tuple.

(c) Primary Key

The candidate key chosen by the designer as the main identifier.

  • RollNo (chosen as primary key)

(d) Alternate Key

Candidate keys not selected as the primary key.

  • RegNo, Email (these are alternate keys)

(e) Foreign Key

An attribute in one table that references the primary key of another table.

  • DeptID in Student references DeptID in Department table.

Q2. Explain normalisation with examples (1NF, 2NF, 3NF).

1NF — First Normal Form

Rule: Every attribute must have atomic (indivisible) values. No repeating groups or multi-valued attributes.

Not in 1NF:

RollNoNameSubjects
101ArunMaths, Physics, Chemistry
102BalaBiology, Maths

In 1NF (each subject in a separate row):

RollNoNameSubject
101ArunMaths
101ArunPhysics
101ArunChemistry
102BalaBiology
102BalaMaths

2NF — Second Normal Form

Rule: Must be in 1NF + no partial dependency (every non-key attribute must depend on the entire primary key, not just part of it).

Not in 2NF (composite key: RollNo + Subject):

RollNoSubjectMarksStudentName
101Maths85Arun
101Physics78Arun
102Maths90Bala

Problem: StudentName depends only on RollNo (partial dependency), not on the full key (RollNo + Subject).

In 2NF (split into two tables):

Student table:

RollNo (PK)StudentName
101Arun
102Bala

Marks table:

RollNo (FK)SubjectMarks
101Maths85
101Physics78
102Maths90

3NF — Third Normal Form

Rule: Must be in 2NF + no transitive dependency (non-key attributes must not depend on other non-key attributes).

Not in 3NF:

RollNo (PK)NameDeptIDDeptName
101ArunD01Computer Science
102BalaD02Physics

Problem: DeptName depends on DeptID (not directly on RollNo). RollNo → DeptID → DeptName is a transitive dependency.

In 3NF (split into two tables):

Student table:

RollNo (PK)NameDeptID (FK)
101ArunD01
102BalaD02

Department table:

DeptID (PK)DeptName
D01Computer Science
D02Physics

Q3. Explain the Join operation with an example.

The Join operation combines rows from two tables based on a related column between them.

Student table:

RollNoNameDeptID
101ArunD01
102BalaD02
103ChitraD01

Department table:

DeptIDDeptName
D01Computer Science
D02Physics

Natural Join: Student ⋈ Department (on DeptID)

RollNoNameDeptIDDeptName
101ArunD01Computer Science
102BalaD02Physics
103ChitraD01Computer Science

The join matches rows where DeptID is the same in both tables.

Q4. What are database constraints? Explain different types.

Database constraints are rules enforced on data to maintain accuracy and integrity.

ConstraintDescriptionExample
NOT NULLColumn cannot have null valuesName VARCHAR(50) NOT NULL
UNIQUEColumn values must be uniqueEmail VARCHAR(100) UNIQUE
PRIMARY KEYUnique + Not Null identifierRollNo INT PRIMARY KEY
FOREIGN KEYReferences primary key of another tableDeptID VARCHAR(5) REFERENCES Dept(DeptID)
CHECKValues must satisfy a conditionMarks INT CHECK (Marks >= 0 AND Marks <= 100)
DEFAULTProvides a default value if none specifiedStatus VARCHAR(10) DEFAULT 'Active'
CREATE TABLE Student (
    RollNo INT PRIMARY KEY,
    Name VARCHAR(50) NOT NULL,
    Email VARCHAR(100) UNIQUE,
    DeptID VARCHAR(5),
    Marks INT CHECK (Marks >= 0 AND Marks <= 100),
    Status VARCHAR(10) DEFAULT 'Active',
    FOREIGN KEY (DeptID) REFERENCES Department(DeptID)
);

Q5. Differentiate between file system and DBMS.

FeatureFile SystemDBMS
Data redundancyHigh (data duplicated)Low (centralised storage)
Data consistencyLowHigh
Data sharingDifficultEasy (concurrent access)
SecurityLimitedComprehensive
Backup and recoveryManualAutomatic
Data independenceNot presentPresent (physical and logical)
Query supportLimitedPowerful (SQL)
Integrity constraintsNot enforcedEnforced
ExampleSpreadsheets, text filesMySQL, PostgreSQL, Oracle

Q6. Explain the relational model with an example.

The relational model represents data as a collection of relations (tables). Each relation has:

  • Relation name (table name)
  • Attributes (column names)
  • Tuples (rows/records)
  • Domain (set of allowed values for each attribute)

Example: Student Relation

Schema: Student(RollNo, Name, Age, DeptID)

Instance (data):

RollNoNameAgeDeptID
101Arun17D01
102Bala18D02
103Chitra17D01

Properties:

  • Each column has a unique name (attribute name)
  • Each cell contains a single atomic value
  • No duplicate rows (tuples are unique)
  • Order of rows and columns is not significant
  • Each row is unique, identifiable by primary key

Q7. Write SQL queries to create tables with primary and foreign keys.

-- Department table
CREATE TABLE Department (
    DeptID VARCHAR(5) PRIMARY KEY,
    DeptName VARCHAR(50) NOT NULL,
    HOD VARCHAR(50)
);

-- Student table with foreign key
CREATE TABLE Student (
    RollNo INT PRIMARY KEY,
    Name VARCHAR(50) NOT NULL,
    Age INT CHECK (Age > 0),
    Email VARCHAR(100) UNIQUE,
    DeptID VARCHAR(5),
    FOREIGN KEY (DeptID) REFERENCES Department(DeptID)
);

-- Insert data
INSERT INTO Department VALUES ('D01', 'Computer Science', 'Dr. Kumar');
INSERT INTO Department VALUES ('D02', 'Physics', 'Dr. Lakshmi');

INSERT INTO Student VALUES (101, 'Arun', 17, '[email protected]', 'D01');
INSERT INTO Student VALUES (102, 'Bala', 18, '[email protected]', 'D02');
INSERT INTO Student VALUES (103, 'Chitra', 17, '[email protected]', 'D01');

Common Mistakes

MistakeWhy It's WrongCorrection
Confusing primary key and candidate keyPrimary key is one chosen candidate keyAll minimal unique identifiers are candidate keys; designer picks one as primary
Saying 3NF does not require 2NF3NF builds on 2NF3NF = 2NF + no transitive dependencies
Allowing null in primary keyPrimary key must be unique and NOT NULLPrimary key columns cannot have null values
Confusing Select (σ) and Project (π)Select filters rows, Project selects columnsσ filters rows; π selects columns
Thinking foreign key must be uniqueForeign key values can repeatMultiple employees can belong to the same department
Ignoring partial dependency in 2NFNon-key attributes must depend on entire PKIn composite key tables, each non-key attribute must depend on ALL key attributes
Confusing super key and candidate keySuper key may have redundant attributesCandidate key is a minimal super key

Exam Checklist

  • [ ] I can define database, DBMS, and relational model
  • [ ] I can differentiate between super key, candidate key, primary key, alternate key, and foreign key
  • [ ] I can perform Select (σ) and Project (π) operations on a given table
  • [ ] I can perform Join operations between two tables
  • [ ] I can explain 1NF, 2NF, and 3NF with examples
  • [ ] I can identify partial and transitive dependencies
  • [ ] I know the six database constraints: NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK, DEFAULT
  • [ ] I can write SQL CREATE TABLE statements with constraints
  • [ ] I can convert unnormalised data to 1NF, 2NF, and 3NF

Frequently Asked Questions

A primary key uniquely identifies each record in a table and cannot be null or duplicate. A foreign key is a column in one table that refers to the primary key of another table, establishing a relationship between the two tables.
← Browse all Class 12 Exercise Solutions

Other question types — same chapter