Quick Review – Summary
File : A file in a file system is a container to store data in a computer.
Disadvantage of File System : File system suffers from Data Redundancy, Data Inconsistency, Data Isolation, Data Dependence and Controlled Data sharing.
DBMS : Database Management System (DBMS) is a software to create and manage databases. A database is a collection of tables.
Database Schema: Database schema is the design of a database
Database Constraint : A database constraint is a restriction on the type of data that that can be inserted into the table.
Database Catalog : Database schema and database constraints are stored in database Catalog. Database Instance : Whereas the snapshot of the database at any given time is the database instance.
Query : A query is a request to a database for information retrieval and data manipulation (insertion, deletion or update). It is written in Structured Query Language (SQL).
RDBMS : Relational DBMS (RDBMS) is used to store data in related tables. Rows and columns of a table are called tuples and attributed respectively. A table is referred to as a relation.
Keys in Database : Destructions on data stored in a RDBMS is applied by use of keys such as Candidate Key, Primary Key, Composite Primary Key, Foreign Key.
Primary Key: Primary key in a relation is used for unique identification of tuples.
Foreign Key : Foreign key is used to relate two tables or relations.
Attributes / Columns : Each column in a table represents a feature (attribute) of a record. Table stores the information for an entity whereas a row represents a record.
Tuples : Each row in a table represents a record. A tuple is a collection of attribute values that makes a record unique.
Tuple vs Attribute : A tuple is a unique entity whereas attribute values can be duplicate in the table.
SQL : SQL is the standard language for RDBMS systems like MySQL.
Class 12 NCERT Exercise Solution
Ch 8 Database Concepts
1. Give the terms for each of the following:
a) Collection of logically related records.
Answer: Table / Relation
b) DBMS creates a file that contains description about the data stored in the database.
Answer: Data dictionary
c) Attribute that can uniquely identify the tuples in a relation.
Answer: Primary Key
d) Special value that is stored when 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.
Answer: Alternate Key
f) Software that is used to create, manipulate and maintain a relational database.
Answer: Database Management System (DBMS), e.g. MySQL, Oracle,
2. Why foreign keys are allowed to have NULL values? Explain with an example.
Answer: The value of 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 NULL value in the foreign key.
For example, Suppose a shopkeeper want to sale the product, but the customer is not a regular customer, so his customer id is not exist. In this case, NULL value is entered to the customerId field.
3. Differentiate between:
a) Database state and database schema
Answer: Database State / Instance :- The data stored in database at a particular moment time of time i.e. the state of the database at a particular instance of time, is called instance of database.
Database Schema :- The logical structure and design of a database is called the database schema. It is the blueprint or skeleton structure of a database.
b) Primary key and foreign key
Answer: 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
Answer: 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?
Answer: A database stores the data at a central location from where all application programs can access data. This avoids to save the same data in multiple files, thus it reduces data redundancy.
5. What are the limitations of file system that can be overcome by a relational DBMS?
Answer : Limitations of file system overcome by DBMS are :-
(a) Difficulty in data access
(b) Data Redundancy
(c) Data Inconsistency
(d) Data Isolation
(e) 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:
a) Roll no 24 may not be interested in sports. Can a NULL value be assigned to that student’s preference field?
Answer: Yes, More than one student can have same sports preference. It means, preference column is not a primary key so that we can give the NULL value in preference column.
b) Roll no 17 has given two preferences sports. Which property of relational DBMS is violated here? Can we use any constraint or key in the relational DBMS to check against such violation, if any?
Answer: Each student suppose to give only one preference, as given. Primary Key constraint can be use to check such types of violation.
c) Kabaddi was not chosen by any student. Is it possible to have this tuple in the Sports Preferences relation?
Answer: A sport preference can not be entered unless it has a value for the Rollno column as primary key cannot left blank.
7. In another class having 2 sections, the two respective class representatives have prepared 2 separate Sports Preferences tables, as shown in the figure (below):
Sports preference of section 1 (arranged on roll number column)
Sports preference of section 2 (arranged on Sports name column, and column order is also different)
Are the states of both the relations equivalent? Justify.
Answer: Yes, the states of both the relations are equivalent as the order of rows and columns doe not matter and data is just the same in both the relations.