Kundali IQ

Home › Free notes › Class 12 Computer Science › Database Concepts

Database Concepts – Class 12 Computer Science notes, important questions and MCQs

NCERT Class 12 Computer Science, chapter 8. Notes, key terms, important questions with answers and MCQs.

हिंदी में पढ़ें

Chapter overview

A database is an organised collection of related data stored so that it can be easily accessed, managed and updated. A database management system (DBMS) is software that creates and manages databases. File systems have limitations such as redundancy and inconsistency, which DBMS overcomes. The relational data model organises data into tables called relations, and keys are used to identify records and link tables.

File system versus DBMS

  • Limitations of file systems: difficulty of access, data redundancy (duplication), data inconsistency, data isolation, data dependence and controlled data sharing problems.
  • A DBMS such as MySQL, Oracle, PostgreSQL or SQLite provides data independence, reduced redundancy, consistency, security, sharing and backup; the database schema is its design, the data dictionary stores metadata, and a database instance is the data at a particular time.
  • Key concepts: database engine, query (a request for data), and data constraints such as NOT NULL and UNIQUE.

Relational model and keys

  • In the relational model, a relation (table) has attributes (columns) and tuples (rows); the degree is the number of attributes and the cardinality is the number of tuples; the domain is the set of allowed values for an attribute.
  • Properties: each attribute has a unique name, each tuple is distinct, the order of rows and columns does not matter, and values are atomic.
  • Keys: a candidate key is any minimal set of attributes that uniquely identifies tuples; the primary key is the chosen candidate key; alternate keys are the remaining candidate keys; a composite primary key has more than one attribute; a foreign key is an attribute in one table that refers to the primary key of another table, enforcing referential integrity.

Key terms

Database
an organised collection of related data
DBMS
software for creating and managing databases
Relation
a table in the relational model
Primary key
an attribute set chosen to uniquely identify each tuple
Foreign key
an attribute that refers to the primary key of another table

Important questions with answers

Distinguish between degree and cardinality.2 marks

Degree is the number of attributes (columns) in a relation, while cardinality is the number of tuples (rows). For example, a STUDENT table with columns RollNo, Name and Class and 40 rows has degree 3 and cardinality 40.

What are the limitations of a file system that a DBMS overcomes?3 marks

File systems suffer from difficulty in accessing data, data redundancy, data inconsistency, data isolation across files, dependence of programs on file formats and poor control over data sharing and security. A DBMS reduces redundancy, ensures consistency, provides easy querying, security and data independence.

Explain the different types of keys in the relational model with examples.5 marks

Keys are attributes or sets of attributes used to identify tuples uniquely and to link relations. Consider a relation STUDENT(AdmNo, RollNo, Name, AadhaarRef, Class). A candidate key is any minimal set of attributes that can uniquely identify each tuple; here AdmNo and AadhaarRef may both be candidate keys, since no two students share them. The primary key is the candidate key chosen by the database designer to identify tuples; it cannot have NULL or duplicate values; suppose AdmNo is chosen. The remaining candidate keys, such as AadhaarRef, are called alternate keys. Sometimes no single attribute is unique; then a composite primary key consisting of two or more attributes is used, for example (Class, RollNo) together, since roll numbers repeat across classes but not within a class. A foreign key is an attribute in one relation whose values must match the primary key values of another relation or be NULL; for example, in a relation FEES(ReceiptNo, AdmNo, Amount), AdmNo is a foreign key referring to STUDENT. Foreign keys maintain referential integrity, ensuring that fees cannot be recorded for a student who does not exist. Keys therefore prevent duplication, support relationships between tables and make queries reliable.

Quick revision

  • Limitations of file systems.
  • DBMS, schema, data dictionary, instance.
  • Relation, attribute, tuple, degree, cardinality, domain.
  • Candidate, primary, alternate, composite and foreign keys.

Exam tips

  • Degree = number of columns; cardinality = number of rows.
  • Primary key cannot be NULL or repeated.

Practice MCQs

  1. Software used to create and manage databases is a

    1. compiler
    2. DBMS
    3. browser
    4. spreadsheet only
    Show answer

    Answer: (b) DBMS. Example: MySQL.

  2. In the relational model, a table is called a

    1. tuple
    2. key
    3. domain
    4. relation
    Show answer

    Answer: (d) relation. Rows are tuples.

  3. Duplication of the same data in different files is called

    1. redundancy
    2. consistency
    3. integrity
    4. independence
    Show answer

    Answer: (a) redundancy. It wastes space and causes inconsistency.

  4. The number of attributes in a relation is its

    1. degree
    2. cardinality
    3. domain
    4. key
    Show answer

    Answer: (a) degree. It counts columns.

  5. A table has 5 columns and 20 rows. Its cardinality is

    1. 5
    2. 20
    3. 25
    4. 100
    Show answer

    Answer: (b) 20. Cardinality counts rows.

  6. Candidate keys that are not chosen as the primary key are

    1. foreign keys
    2. composite keys
    3. alternate keys
    4. super columns
    Show answer

    Answer: (c) alternate keys. They can also identify tuples uniquely.

  7. An attribute in one table that refers to the primary key of another table is a

    1. candidate key
    2. alternate key
    3. foreign key
    4. domain
    Show answer

    Answer: (c) foreign key. It enforces referential integrity.

  8. Which statement about a primary key is correct

    1. it can contain NULL values
    2. it must always be a single column
    3. a table can have many primary keys
    4. it must be unique and NOT NULL for every tuple
    Show answer

    Answer: (d) it must be unique and NOT NULL for every tuple. Composite primary keys have multiple columns.

All chapters of Class 12 Computer Science

Written by Kundali IQ from standard, well-established facts to help with revision. This is not an official NCERT publication; always read your textbook too.