NCERT Solutions Class 12, Computer Science, Chapter- 8, Database Concepts
Exercise
1. Give the terms for each of the following:
a) Collection of logically related records.
Solution:
Database term collection of logically related records.
b) DBMS creates a file that contains description about the data stored in the database.
Solution:
The relational database term DBMS creates a file that contains a description of the data stored in the database.
c) Attribute that can uniquely identify the tuples in a relation.
Solution:
KEY term attribute that can uniquely identify the tuples in a relation.
d) Special value that is stored when actual data value is unknown for an attribute.
Solution:
The NULL term refers to the special value that is stored when the actual data value is unknown for an attribute.
e) An attribute which can uniquely identify tuples of the table but is not defined as primary key of the table.
Solution:
The Super Key term refers to an attribute that can uniquely identify tuples of the table but is not defined as the primary key of the table.
f) Software that is used to create, manipulate and maintain a relational database.
Solution:
A relational Database Management System term refers to software that is used to create, manipulate and maintain a relational database.
2. Why foreign keys are allowed to have NULL values? Explain with an example.
Solution:
The value of the foreign key is derived from the Primary key of the primary table. Sometimes, we want to enter a record, which is not related. To handle this situation, it is allowed to enter a NULL value in the foreign key.
For example, Suppose a shopkeeper wants to sell a product, but the customer is not a regular customer, so his customer id does not exist. In this case, a NULL value is entered into the customerId field.
3. Differentiate between:
a) Database state and database schema
Solution:
Database state |
Database schema |
It is the collection of information stored in a database at a particular moment. |
It is the overall description of the database. |
Data in instances can be changed using addition, deletion, and updation. |
The schema is same for the whole database. |
Changes Frequently. |
Does not change Frequently. |
It is the set of Information stored at a particular time. |
Defines the basic structure of the database i.e. how the data will be stored in the database. |
b) Primary key and foreign key
Solution:
Primary Key: Primary key is a column or group of columns in a table that uniquely identify the records in the table.
Foreign Key: Foreign keys are the columns of the table which refer to the primary key of another table. A foreign key creates a relationship between two tables.
c) Degree and cardinality of a relation
Solution:
Degree: Degree refers to the number of columns or attributes in a relation/table.
Cardinality: Cardinality refers to the number of rows/ records/tuples in a relation/table.
4. Compared to a file system, how does a database management system avoid redundancy in data through a database?
Solution:
- Redundancy is prevented in a database as there is a single database and any change in it is reflected immediately.
- Because of this, there is no chance of encountering duplicate data.
5. What are the limitations of file system that can be overcome by a relational DBMS?
Solution:
Limitations of the file system overcome by DBMS are:
- Difficulty in data access
- Data Redundancy
- Data Inconsistency
- Data Isolation
- Data dependence.
6. A school has a rule that each student must participate in a sports activity. So each one should give only one preference for sports activity. Suppose there are five students in a class, each having a unique roll number. The class representative has prepared a list of sports preferences as shown below. Answer the following:
Table: Sports Preferences
Roll_no |
Preference |
9 |
Cricket |
13 |
Football |
17 |
Badminton |
17 |
Football |
21 |
Hockey |
24 |
NULL |
NULL |
Kabaddi |
a) Roll no 24 may not be interested in sports. Can a NULL value be assigned to that student’s preference field?
Solution:
Yes, a NULL value can be assigned to that student's preference field.
b) Roll no 17 has given two preferences in sports. Which property of relational DBMC is violated here? Can we use any constraint or key in the relational DBMS to check against such violation, if any?
Solution:
Property 2 is violated here because each row in a relation is distinct. The primary key can use to identify each row/record in a database table.
c) Kabaddi was not chosen by any student. Is it possible to have this tuple in the Sports Preferences relation?
Solution:
No, it is not possible to have this tuple in the sports preferences relation because Roll_no is the primary key and the primary key does not allow NULL values.