NCERTCh 7Free

Database Chapter Concepts

🎓 Class 11📖 Informatics Practices📖 9 notes🧠 15 Q&A⏱️ ~14 min

Database Chapter ConceptsStudy Notes

NCERT-aligned · 9 notes · 3 shown free

7.1 INTRODUCTION

Explanation

7.1 INTRODUCTION

This section introduces the importance of data storage and management in electronic form, building on the previous chapter's emphasis on data importance. It uses a school example to illustrate the challenges of manual data recording, specifically attendance and guardian details. The class teacher marks daily attendance for 50 students over 26 working days, resulting in 1300 manual entries monthly. Manual record keeping is tedious and error-prone, leading to issues such as inconsistent data entry, data loss, and calculation errors. The office staff also maintain student and guardian details manually, which complicates data retrieval and modification. To overcome these limitations, storing data electronically in separate data files is proposed. This enables easy copying of student details when promoted, quick data retrieval, addition, modification, and deletion of records. The section sets the stage for understanding file systems and database management systems as solutions to manual data handling problems.

  • Manual attendance recording for 50 students over 26 days results in 1300 entries monthly.
  • Manual record keeping leads to inconsistencies, data loss, and errors in calculations.
  • Student and guardian details are maintained manually, complicating data retrieval and updates.
  • Electronic storage in separate data files can simplify copying, searching, adding, modifying, and deleting data.
  • Manual systems are inefficient for large volumes of data and prone to errors.
  • Need for computerized data management to improve accuracy and ease of access.
  • 📌 Data: Facts or information stored for processing.
  • 📌 Manual Record Keeping: Storing data physically on paper without electronic aid.
  • 📌 Attendance Register: A record book where daily attendance is marked.

7.2 FILE SYSTEM

Explanation

7.2 FILE SYSTEM

This section explains the concept of a file system as a container to store data on a computer's storage device. Files can contain text, program code, CSV data, images, audio, video, or web pages. Accessing data from files requires application programs to read and manipulate the stored data. Using the school example, student and attendance data are stored in two separate files: STUDENT and ATTENDANCE. The STUDENT file contains six columns: RollNumber, SName, SDateofBirth, GName, GPhone, and GAddress. The ATTENDANCE file contains AttendanceDate, RollNumber, SName, and AttendanceStatus. The section presents sample tables for both files. It then discusses the limitations of file systems, including difficulty in data access, data redundancy, inconsistency, data isolation, data dependence, and lack of controlled data sharing. These limitations make file systems inefficient for large and complex data management tasks, highlighting the need for more advanced database systems.

  • A file stores data on a computer and can contain various types of content.
  • Data access from files requires writing application programs.
  • STUDENT and ATTENDANCE files store student and attendance data respectively.
  • File systems suffer from difficulty in accessing data in required formats.
  • Data redundancy and inconsistency arise due to duplicate data across files.
  • File systems lack data isolation, data independence, and controlled data sharing.
  • 📌 File: A container for storing data on a computer.
  • 📌 Data Redundancy: Duplication of data across multiple files.
  • 📌 Data Inconsistency: Mismatch of data values in different files.

7.2.1 Limitations of a File System

Explanation

7.2.1 Limitations of a File System

This subsection elaborates on the specific limitations of file systems in managing data efficiently. It discusses six key limitations: (A) Difficulty in Access - files do not provide direct mechanisms for data retrieval; accessing data requires appli

Practice QuestionsDatabase Chapter Concepts

Includes NCERT exercise questions with answers

Q1.1. Give the terms for each of the following: a) Collection of logically related records. b) DBMS creates a file that contains description about the data stored in the database. c) 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. e) An attribute which can uniquely identify tuples of the table but is not defined as primary key of the table. f) Software that is used to create, manipulate and maintain a relational database.

Answer:

a) Relation or Table b) Data Dictionary or Metadata c) Primary Key d) NULL value e) Candidate Key or Alternate Key f) Database Management System (DBMS)

Explanation:

a) A collection of logically related records is called a relation or table in a database. b) DBMS maintains a data dictionary or metadata file that describes the structure of the database. c) Primary key is an attribute that uniquely identifies each tuple in a relation. d) NULL is a special marker used when the actual data value is unknown or missing. e) Candidate key is an attribute that can uniquely identify tuples but is not chosen as primary key. f) DBMS is software used to create, manipulate, and maintain databases.

EasyNCERT
Q2.2. Why foreign keys are allowed to have NULL values? Explain with an example.

Answer:

Foreign keys are allowed to have NULL values because a foreign key represents a reference to a primary key in another table, and sometimes the relationship may be optional. When there is no related tuple in the referenced table, the foreign key can be NULL to indicate the absence of a relationship. Example: Consider two tables, STUDENT and SPORTS_PREFERENCE. If a student has not chosen any sport, the foreign key in SPORTS_PREFERENCE referring to STUDENT's primary key can be NULL, indicating no sports preference.

Explanation:

Foreign keys enforce referential integrity by linking tables. However, not all tuples must have a related tuple in the referenced table. Allowing NULL values in foreign keys permits optional relationships and avoids forcing invalid references.

MediumNCERT
Q3.3. Differentiate between: a) Database state and database schema b) Primary key and foreign key c) Degree and cardinality of a relation

Answer:

a) Database Schema vs Database State: - Schema is the structure or design of the database, defined by tables, attributes, and constraints. It is fixed and does not change frequently. - State is the actual data stored in the database at a particular moment. It changes as data is inserted, updated, or deleted. b) Primary Key vs Foreign Key: - Primary key uniquely identifies each tuple in a relation. - Foreign key is an attribute in one relation that refers to the primary key in another relation to establish a link. c) Degree vs Cardinality of a Relation: - Degree is the number of attributes (columns) in a relation. - Cardinality is the number of tuples (rows) in a relation.

Explanation:

Understanding these differences helps in database design and integrity enforcement. Schema defines structure, state is data content. Primary key ensures uniqueness, foreign key maintains relationships. Degree and cardinality describe relation's shape and size.

MediumNCERT
Q4.4. Compared to a file system, how does a database management system avoid redundancy in data through a database?

Answer:

A DBMS avoids redundancy by storing data in a structured way using relations (tables) and enforcing constraints such as primary keys and foreign keys. It normalizes data to eliminate duplicate storage and maintains data consistency by centralizing data management. Unlike file systems where data is stored in separate files leading to duplication, DBMS uses relationships and keys to store data only once and reference it as needed.

Explanation:

Redundancy leads to inconsistency and wastes storage. DBMS uses normalization and relational design to minimize redundancy, ensuring data integrity and efficient storage.

MediumNCERT
Q5.5. What are the limitations of file system that can be overcome by a relational DBMS?

Answer:

Limitations of file system overcome by relational DBMS include: - Data redundancy and inconsistency - Difficulty in accessing data - Data isolation in multiple files - Integrity problems - Atomicity of updates - Concurrent access anomalies - Security problems Relational DBMS provides centralized data management, supports complex queries, enforces integrity constraints, and allows concurrent multi-user access with security.

Explanation:

File systems lack mechanisms for data integrity, security, and efficient access. DBMS addresses these by providing structured storage, query languages, and transaction management.

MediumNCERT
Q6.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? b) Roll no 17 has given two preferences 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? c) Kabaddi was not chosen by any student. Is it possible to have this tuple in the Sports Preferences relation?

Answer:

a) Yes, a NULL value can be assigned to the preference field for roll no 24 if the student is not interested in any sport. NULL indicates unknown or no data. b) The property violated is the 'Entity Integrity' or 'Uniqueness' property because roll no 17 appears twice with different preferences, violating the rule that each student should have only one preference. To prevent this, a PRIMARY KEY or UNIQUE constraint can be applied on the 'Roll no' attribute to ensure uniqueness. c) Yes, it is possible to have a tuple with NULL roll no and preference 'Kabaddi' if the roll no is unknown or missing. However, this violates referential integrity if 'Roll no' is a foreign key referencing students. Normally, such tuples should not exist unless roll no is optional.

Explanation:

a) NULL values represent missing or unknown data. b) Primary key constraints enforce uniqueness. c) Tuples with NULL in key fields may violate integrity constraints.

MediumNCERT
Q7.7. In another class having 2 sections, the two respective class representatives have prepared 2 separate Sports Preferences tables, as shown below: Sports preference of section 1 (arranged on roll number column) Table: Sports Preferences | Roll no | Sports | | --- | --- | | 9 | Cricket | | 13 | Football | | 17 | Badminton | | 21 | Hockey | | 24 | Cricket | Sports preference of section 2 (arranged on Sports name column, and column order is also different) Table: Sports Preferences | Sports | Roll no | | --- | --- | | Badminton | 17 | | Cricket | 9 | | Cricket | 24 | | Football | 13 | | Hockey | 21 | Are the states of both the relations equivalent? Justify.

Answer:

Yes, the states of both relations are equivalent because they contain the same set of tuples, only the order of rows and columns differ. In relational databases, the order of tuples and attributes does not affect the relation's state. Both tables represent the same information about students' sports preferences.

Explanation:

Relational model treats relations as sets of tuples, so order is irrelevant. Column order and tuple order do not affect equivalence of relations.

MediumNCERT
Q8.8. The school canteen wants to maintain records of items available in the school canteen and generate bills when students purchase any item from the canteen. The school wants to create a canteen database to keep track of items in the canteen and the items purchased by students. Design a database by answering the following questions: a) To store each item name along with its price, what relation should be used? Decide appropriate attribute names along with their data type. Each item and its price should be stored only once. What restriction should be used while defining the relation? b) In order to generate bill, we should know the quantity of an item purchased. Should this information be in a new relation or a part of the previous relation? If a new relation is required, decide appropriate name and data type for attributes. Also, identify appropriate primary key and foreign key so that the following two restrictions are satisfied: i) The same bill cannot be generated for different orders. ii) Bill can be generated only for available items in the canteen. c) The school wants to find out how many calories students intake when they order an item. In which relation should the attribute 'calories' be stored?

Answer:

a) Relation: ITEM Attributes: ItemName (VARCHAR), Price (FLOAT) Restriction: ItemName should be PRIMARY KEY to ensure each item and its price is stored only once. b) Quantity of items purchased should be stored in a new relation named PURCHASE or BILL_DETAIL. Attributes: BillNo (INT), ItemName (VARCHAR), Quantity (INT) Primary Key: Composite key of (BillNo, ItemName) Foreign Key: ItemName referencing ITEM(ItemName) This ensures: i) Same bill number cannot be used for different orders because BillNo identifies the bill uniquely. ii) Bill can be generated only for available items because ItemName must exist in ITEM relation. c) The attribute 'calories' should be stored in the ITEM relation as it is a property of the item itself, not of the purchase.

Explanation:

a) Storing item and price once avoids redundancy. b) Purchase details need a separate relation to handle multiple items per bill. c) Calories are intrinsic to items, so stored in ITEM relation.

MediumNCERT