Chapter 11: Database Concepts Class 12 Computer Science NCERT Solutions
Databases are the backbone of modern applications where data storage and management are crucial. In Chapter 11 – Database Concepts, students are introduced to the basics of database systems, their types, and how to interact with databases using SQL. This chapter builds the foundation for understanding data handling in real-world applications.
What You Will Learn in Chapter 11
This chapter provides a clear understanding of what databases are, the difference between DBMS and RDBMS, how data is stored in tables, and how to retrieve and manipulate data using SQL queries. Students will also learn key concepts like normalization, keys, and relational models.
Key Topics Covered
Introduction to Databases
A Database is an organized collection of data that can be easily accessed, managed, and updated. Databases are used in banks, schools, websites, and apps for managing large amounts of structured data.
DBMS vs RDBMS
DBMS | RDBMS |
---|---|
Stores data in files or simple formats | Stores data in tabular (row-column) format |
No relationships between data | Supports relationships using foreign keys |
Less secure and scalable | High-level data security and normalization |
Basic Terms
- Table: A collection of rows and columns (also called a relation).
- Record: A single row in the table.
- Field: A column that stores a specific type of data.
- Primary Key: Uniquely identifies each record in a table.
- Foreign Key: Establishes a relationship between two tables.
Database Models
- Hierarchical Model
- Network Model
- Relational Model (RDBMS) – Most commonly used
Relational Database Concepts
- Tables are called relations
- Each row is a tuple or record
- Each column is an attribute or field
Normalization
Normalization is the process of organizing data to minimize redundancy. It involves dividing large tables into smaller ones and defining relationships between them.
- 1NF: Atomic values, no repeating groups
- 2NF: Full functional dependency
- 3NF: No transitive dependency
Structured Query Language (SQL)
SQL is the standard language used to interact with relational databases. It is used for inserting, updating, deleting, and querying data.
SQL Operations
- DDL (Data Definition Language): CREATE, DROP, ALTER
- DML (Data Manipulation Language): INSERT, UPDATE, DELETE
- DQL (Data Query Language): SELECT
Example Queries
CREATE TABLE Students (
RollNo INT PRIMARY KEY,
Name VARCHAR(50),
Marks INT
);
INSERT INTO Students VALUES (101, \'Ravi\', 85);
SELECT * FROM Students WHERE Marks > 80;
UPDATE Students SET Marks = 90 WHERE RollNo = 101;
DELETE FROM Students WHERE Name = \'Ravi\';
Keys in DBMS
- Primary Key: Ensures uniqueness of each row
- Candidate Key: Set of fields that can qualify as a primary key
- Foreign Key: Creates a link between tables
Advantages of Database Systems
- Data consistency and accuracy
- Centralized data management
- Data security and integrity
- Reduced redundancy and duplication
- Easy retrieval and reporting
Common Database Questions
- Define and differentiate DBMS and RDBMS
- Write SQL queries for table creation and data manipulation
- Explain primary key and foreign key with examples
- Normalize a given table up to 3NF
Download Chapter 11 Solutions PDF – Database Concepts
Our PDF includes:
- NCERT textbook solutions with SQL code
- SQL query explanations with output
- Normalization problems and solved examples
- Database schema diagrams
Highlights of Our NCERT Solutions
- Easy-to-follow SQL code with explanations
- Concept flowcharts for normalization and key relationships
- Important theory questions from board exam perspective
- Real-world database examples with relatable scenarios
Recommended Preparation Tips
- Understand each SQL command with examples
- Practice creating tables and writing queries
- Memorize key differences between DBMS and RDBMS
- Study normalization rules with solved questions
- Focus on concept clarity of keys and table relationships
Additional Study Resources
- SQL Flashcards: Syntax and examples
- Worksheets: SQL queries and normalization tasks
- MCQs: Based on theory and SQL output
- Previous Year Questions: SQL-based coding and theory
- Practice Projects: Create student or library databases
Mastering Chapter 11 – Database Concepts
A strong foundation in database concepts is essential for every computer science student. Whether you\’re building software, managing websites, or analyzing data, knowledge of how databases work is crucial. With practical SQL practice and clarity in relational models, students can confidently handle real-world data management challenges.
Class 12 Computer Science (C++) – Chapter 11 Database Concepts
Short Answer Type Questions [4 marks each]
Question 1: What is a relation? Define the relational data model.
A relation is a table consisting of rows and columns, where each column contains atomic (indivisible) values, all rows are unique, and the order of rows and columns does not matter.
The relational data model represents data and relationships among data using a collection of tables (called relations), where each table consists of uniquely named columns (attributes).
Question 2: What are all the domain names possible in gender?
Possible domain values for gender can be:
– Male
– Female
Question 3: Give a suitable example of a table with sample data and illustrate Primary and Candidate Keys in it.
RollNo | Name | |
---|---|---|
101 | Amit | amit@gmail.com |
102 | Riya | riya@gmail.com |
Candidate Keys: RollNo, Email
Primary Key: RollNo
Question 4: Differentiate between cardinality and degree of a table with the help of an example.
Cardinality: Number of rows (tuples) in a table.
Degree: Number of columns (attributes) in a table.
AccountNo | Name |
---|---|
101 | Amit |
102 | Riya |
103 | Meena |
Cardinality = 3
Degree = 2
Question 5: Observe the given table and identify (i) Candidate Keys, and (ii) Primary Key.
(Assume a Product table with columns: Id, Product, Price, TransactionDate)
Candidate Keys: Id, Product
Primary Key: Id
Question 6: From the given table, write (i) Candidate Keys and (ii) Primary Key.
(Assume an Item table with columns: Code, Item, Price, TransactionDate)
Candidate Keys: Code, Item
Primary Key: Code
Question 7: Define degree and cardinality. Based on the given table, state its degree and cardinality.
(Assume a table “Patients” with 4 columns and 5 rows)
Degree: 4
Cardinality: 5
Question 8: Differentiate between the Primary Key and Alternate Key of a table with an example.
Primary Key: A column that uniquely identifies each record in a table.
Alternate Key: A candidate key that is not chosen as the primary key.
AadhaarNo | BankAccountNo | Name |
---|---|---|
1234567890 | 9876543210 | Amit |
Candidate Keys: AadhaarNo, BankAccountNo
Primary Key: AadhaarNo
Alternate Key: BankAccountNo
Question 9: Explain the concept of candidate keys with a suitable example.
A candidate key is an attribute or a combination of attributes that can uniquely identify a record in a table.
AdminNo | RollNo | Name |
---|---|---|
A001 | R001 | Rahul |
Here, both AdminNo and RollNo can uniquely identify each student.
Candidate Keys: AdminNo, RollNo
Question 10: A table ‘customer’ has 10 columns but no row. Later, 10 new rows are inserted and 3 rows are deleted. What is the degree and cardinality of the table now?
Degree: 10 (number of columns)
Cardinality: 7 (10 rows inserted – 3 rows deleted)
Question 11: A table ‘student’ has 3 columns and 10 rows and another table ‘student2’ has the same number of columns and 15 rows. 5 rows are common in both the tables. If we take union, what is the degree and cardinality of the resultant table?
Degree: 3
Cardinality: 10 + 15 – 5 = 20
Question 12: A table ‘student1’ has 4 columns and 10 rows and table ‘student2’ has 5 columns and 5 rows. If we take cartesian product of these two tables, what is the degree and cardinality of the resultant table?
Degree: 4 + 5 = 9
Cardinality: 10 × 5 = 50
Question 13: Observe the following table and answer the parts (i) and (ii):
(i) Can we have Qty as primary key?
(ii) What is the cardinality and degree of the table?
(i) No, we cannot use Qty as the primary key because it contains duplicate values, and a primary key must be unique.
(ii) Degree = 4
Cardinality = 5
Question 14: What do you understand by Union & Cartesian product in relational algebra?
Union (R ∪ S): Combines all unique tuples from relation R and S. Duplicate rows are removed.
Cartesian Product (R × S): Combines each tuple of R with every tuple of S, resulting in all possible combinations.
Example: Cartesian product combines each row of one table with all rows of the other table.
Question 15: Explain the concept of union between two tables, with the help of an appropriate example.
The union operation (∪) combines the result of two tables with similar structure. The resulting table includes all distinct rows that appear in either or both of the original tables.
Example: (Refer to: ncert-solutions-for-class-12-computer-science-c-database-concepts-4-14-2)
Question 11: A table ‘student’ has 3 columns and 10 rows and another table ‘student2’ has the same number of columns and 15 rows. 5 rows are common in both the tables. If we take union, what is the degree and cardinality of the resultant table?
Degree: 3
Cardinality: 10 + 15 – 5 = 20
Question 12: A table ‘student1’ has 4 columns and 10 rows and table ‘student2’ has 5 columns and 5 rows. If we take cartesian product of these two tables, what is the degree and cardinality of the resultant table?
Degree: 4 + 5 = 9
Cardinality: 10 × 5 = 50
Question 13: Observe the following table and answer the parts (i) and (ii):
(i) Can we have Qty as primary key?
(ii) What is the cardinality and degree of the table?
(i) No, we cannot use Qty as the primary key because it contains duplicate values, and a primary key must be unique.
(ii) Degree = 4
Cardinality = 5
Question 14: What do you understand by Union & Cartesian product in relational algebra?
Union (R ∪ S): Combines all unique tuples from relation R and S. Duplicate rows are removed.
Cartesian Product (R × S): Combines each tuple of R with every tuple of S, resulting in all possible combinations.
Example: Cartesian product combines each row of one table with all rows of the other table.
Question 15: Explain the concept of union between two tables, with the help of an appropriate example.
The union operation (∪) combines the result of two tables with similar structure. The resulting table includes all distinct rows that appear in either or both of the original tables.
Example: (Refer to: ncert-solutions-for-class-12-computer-science-c-database-concepts-4-14-2)
Question 16: In the following 2 tables, find the union value of Student 1 and Student 2.
(Refer to: ncert-solutions-for-class-12-computer-science-c-database-concepts-4-16)
Answer:
The resultant table is:
(Refer to: ncert-solutions-for-class-12-computer-science-c-database-concepts-4-16-1)
Question 17: Observe the table ‘Club’ given below:
(Refer to: ncert-solutions-for-class-12-computer-science-c-database-concepts-4-17)
(i) Cardinality: 4
Degree: 5
(ii) After updates:
Cardinality: 7
Degree: 6
Question 18: In which situation can we apply the union operation on two tables?
Union can be applied if:
– Both tables have the same number of columns
– The corresponding columns have similar data types
– Columns are in the same order
Short Answer Type Questions – II
Question 1: Observe the following STUDENTS and EVENTS tables carefully and write the name of the RDBMS operation which will be used to produce the output as shown in LIST. Also, find the Degree and Cardinality of the LIST.
(Refer to: ncert-solutions-for-class-12-computer-science-c-database-concepts-4-18)
RDBMS Operation: Cartesian Product
Degree: 4
Cardinality: 6
Question 2: Observe the following PARTICIPANTS and EVENTS tables 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.
(Refer to: ncert-solutions-for-class-12-computer-science-c-database-concepts-4-2)
RDBMS Operation: Cartesian Product
Degree: 4
Cardinality: 6