CBSE Class 12 Computer Science Chapter 4: Database Concepts NCERT Solutions

NCERT Solutions PDF Class 12 PDF

CBSE Class 12 Computer Science Chapter 4, Database Concepts, NCERT Solutions, delves into the core principles of Relational Database Management Systems (RDBMS). This chapter introduces fundamental operations such as the Cartesian Product, essential for understanding how tables can be combined. It clarifies the critical concepts of Degree and Cardinality, explaining what they represent in the context of database tables with illustrative examples. Students will gain proficiency in identifying primary keys, a crucial aspect of database design, and learn to recognize why certain attributes are unsuitable as primary keys due to potential data duplication. Furthermore, the solutions explore the UNION operation, demonstrating its utility in merging compatible tables. This comprehensive guide aims to solidify students' understanding of these vital database concepts, providing clear explanations and practical problem-solving approaches to ensure thorough preparation for examinations.

Quick info

BoardCBSE
ClassClass 12
SubjectComputer Science (Python)
Session2026
LanguageEnglish
TypeNCERT Solutions
ChapterChapter 4

Chapter summary

Chapter 4, Database Concepts, delves into the foundational elements of relational database management systems (RDBMS). This NCERT Solutions set explains key concepts such as the Cartesian Product operation, which combines records from two tables. It also defines and illustrates Degree (number of attributes) and Cardinality (number of tuples) using practical examples. The solutions address the criteria for selecting a primary key, highlighting the importance of uniqueness, and explain the UNION operation for merging compatible tables. This chapter is crucial for understanding how data is organized and manipulated in relational databases.

Learning outcomes

  • Understand the concept of Cartesian Product in RDBMS.
  • Define and calculate the Degree and Cardinality of a table.
  • Identify suitable primary keys for a given table.
  • Explain the purpose and application of the UNION operation between tables.
  • Analyze table structures to determine relational database properties.

Topics covered

Paper topics

  • RDBMS Operations
  • Cartesian Product
  • Degree of a Table
  • Cardinality of a Table
  • Primary Key
  • Table Attributes
  • Table Tuples
  • UNION Operation
  • Data Manipulation
  • Relational Algebra Concepts

Important topics

  • Degree and Cardinality
  • Cartesian Product
  • Primary Key Selection
  • UNION Operation

PDF preview

Read page by page below. PDF is streamed from the official NCERT website — no download button on this page.

Loading document …
Page of
Loading page …

Questions and Solutions

Question 1

Observe the following PARTICIPANTS and EVENTS table carefully and write the name of the RDBMS operation which will be used to produce the output as shown in RESULT? Also, find the Degree and Cardinality of the RESULT.

PARTICIPANTS Table:

NO. Name

1 Aruanabha Tariban

2 John Fedricks

3 Kanti Desai

EVENTS Table:

EVENTCODE EVENTNAME

1001 IT Quiz

1002 Group Debate

RESULT Table:

No. Name EVENTCODE EVENTNAME

1 Aruanabha Tariban 1001 IT Quiz

1 Aruanabha Tariban 1002 Group Debate

2 John Fedricks 1001 IT Quiz

2 John Fedricks 1002 Group Debata

3 Kanti Desai 1001 IT Quiz

3 Kanti Desai 1002 Group Debata

Solution:

The RDBMS operation used to produce the RESULT table is the Cartesian Product. This operation combines each row from the PARTICIPANTS table with each row from the EVENTS table.

To find the Degree and Cardinality of the RESULT table:

  • Degree is the number of columns in the RESULT table. The RESULT table has columns: No., Name, EVENTCODE, EVENTNAME. Therefore, the Degree is 4.
  • Cardinality is the number of rows in the RESULT table. It is calculated by multiplying the Cardinality of the PARTICIPANTS table (3 rows) by the Cardinality of the EVENTS table (2 rows). So, Cardinality = 3 * 2 = 6.

Answer:

RDBMS Operation: Cartesian Product

Degree = 4

Cardinality = 6

Question 2

Define degree and cardinality. Also, based upon the given table 'Patients', write its degree and cardinality.

Table: Patients PatNo PatName Dept DocID 1 Leena ENT 100 2 Supreeth Ortho 200 3 Madhu ENT 100 4 Neha ENT 100 5 Deepak Ortho 200

Solution:

Degree: The degree of a relation (table) is defined as the total number of attributes or columns it contains.

Cardinality: The cardinality of a relation (table) is defined as the total number of tuples or rows it contains.

For the given 'Patients' table:

  • The attributes (columns) are PatNo, PatName, Dept, and DocID. Thus, the Degree is 4.
  • The tuples (rows) are the five entries listed for patients Leena, Supreeth, Madhu, Neha, and Deepak. Thus, the Cardinality is 5.

Answer:

Degree = 4

Cardinality = 5

Question 3

Observe the following table 'Store' and answer the parts (i) and (ii):

Table: Store Item Code Item Qty Rate 10 Gel Pen Classic 11 50 25 11 Sharpener 15 00 10 12 Ball Pen 0.5 16 00 12 13 Eraser 16 00 5 15 Ball Pen 0.25 8 00 20

  1. In the above table, can we have Qty as primary key?
  2. What is the cardinality and degree of the above table?
Solution:
  1. Can Qty be a primary key? No, we cannot use 'Qty' as the primary key in the 'Store' table. A primary key must contain unique values for each row. In the given table, the value '1600' appears twice for 'Qty' (for Item Code 12 and 13). Since there are duplicate values, 'Qty' cannot serve as a primary key.
  2. Cardinality and Degree:
    • Degree: The degree is the number of attributes (columns) in the table. The columns are 'Item Code', 'Item', 'Qty', and 'Rate'. Therefore, the Degree is 4.
    • Cardinality: The cardinality is the number of tuples (rows) in the table. There are 5 entries for different items. Therefore, the Cardinality is 5.

Answer:

1. No, because 'Qty' has duplicate values (1600).

2. Degree = 4

Cardinality = 5

Question 4

Explain the concept of union between two tables, with the help of an appropriate example.
Solution:

The UNION operation in relational database management systems (RDBMS) is used to combine the rows from two or more tables that have compatible structures. Compatibility means that the tables must have the same number of columns, and the corresponding columns must have compatible data types.

The UNION operation returns all distinct rows that appear in either of the tables. It automatically eliminates duplicate rows from the combined result set.

Example:

Consider two tables, TableA and TableB, both containing student names:

TableA

StudentID Name
1 Alice
2 Bob

TableB

StudentID Name
2 Bob
3 Charlie

To find all unique students from both tables, we can use the UNION operation:

SELECT Name FROM TableA UNION SELECT Name FROM TableB;

The result of this operation would be:

Name
Alice
Bob
Charlie

Notice that 'Bob' appears in both tables, but the UNION operation includes 'Bob' only once in the final result, ensuring distinctness.

Common mistakes

  • Confusing Degree and Cardinality.
  • Incorrectly identifying a primary key when duplicate values exist in a column.
  • Misunderstanding the conditions required for the UNION operation.
  • Errors in calculating the result of a Cartesian Product.

Revision tips

  • Practice calculating Degree and Cardinality for various table structures.
  • Review the conditions for selecting a primary key, especially regarding uniqueness.
  • Work through examples of Cartesian Product and UNION operations to solidify understanding.
  • Use the provided tables to create your own scenarios and test your knowledge.

Practice MCQs

Q1. What RDBMS operation combines rows from two tables based on matching criteria or all possible combinations?

Q2. In a table, what does 'Degree' refer to?

Q3. What is 'Cardinality' of a table?

Q4. Why can 'Qty' not be a primary key in the 'Store' table?

Q5. The UNION operation in RDBMS is used to:

Frequently asked questions

What is the main focus of Chapter 4: Database Concepts for Class 12 Computer Science?

Chapter 4 focuses on fundamental database concepts, including RDBMS operations like Cartesian Product, understanding table properties such as Degree and Cardinality, and the principles of selecting primary keys and using the UNION operation.

How do these NCERT Solutions help with understanding Degree and Cardinality?

The solutions define Degree as the number of columns and Cardinality as the number of rows, illustrating these concepts with examples from provided tables, making it easier to grasp their meaning and calculation.

What is a Cartesian Product and how is it explained in the solutions?

The Cartesian Product is an RDBMS operation that combines every row from the first table with every row from the second table. The solutions demonstrate this with an example showing the resulting table structure and size.

Can I use any column as a primary key?

No, a primary key must uniquely identify each row in a table. The solutions explain that columns with duplicate values, like 'Qty' in the 'Store' table example, cannot be used as primary keys.

What is the purpose of the UNION operation?

The UNION operation is used to combine the rows from two tables that have compatible structures (same number of columns and compatible data types). It merges the rows and removes any duplicate rows from the combined result.

How can these solutions aid in exam preparation?

By providing clear explanations and step-by-step solutions to common database concept questions, these resources help students reinforce their understanding, practice problem-solving, and prepare effectively for exam questions related to RDBMS operations and table properties.

Content reviewed by the NCERT Help team. Editorial Team and update policy

NCERT Solutions PDF PDF on NCERT Help. URL unchanged for search indexing.