2nd PUC Computer Science Chapter 8 Database Concepts Notes | NCERT Board 2026
2nd PUC / Class XII Computer Science
Complete Short Notes & Exam Preparation Guide
Based on the NCERT textbook
Chapter Overview
This chapter explains the need for storing and managing data electronically. It begins with the limitations of manual record keeping and file systems, then introduces Database Management Systems (DBMS), the relational data model, important relational database terminology and different types of keys.
8.1 Introduction
Data is important and needs to be stored and managed electronically. The chapter uses the example of a school that maintains student details, attendance records and guardian details.
In a manual attendance register, the teacher records P for present and A for absent against each student’s roll number for every working day.
Limitations of Manual Record Keeping
- Student details have to be entered again in the new attendance register when a student is promoted to the next class.
- Writing student details on every month’s attendance page may cause inconsistency because names may be written incorrectly or records may be skipped.
- Data may be lost if the attendance register is lost or damaged.
- Manual consolidation of attendance may result in erroneous calculations.
Why Computerised Data Storage?
Student and attendance details can be stored in separate data files on a computerised system. This allows office staff and teachers to:
- Copy student details to the new attendance file when students are promoted.
- Find information about a student or guardian.
- Add details whenever a new student joins the school.
- Modify stored student or guardian information when required.
- Remove or delete data when a student leaves the school.
Student and Guardian Details
The office staff maintains student details such as Roll Number, Name and Date of Birth, along with guardian details such as Guardian Name, Contact Number and Address. These details are required for correspondence with guardians regarding attendance and results.
8.2 File System
The contents of a file may include text, computer program code, comma separated values (CSV), pictures, audio/video and web pages.
Files stored on a computer can be accessed directly and searched for desired data. However, to access data from a file through software, application programs need to be written.
School Attendance Example
Two separate files are maintained:
Contains student and guardian-related information.
Contains attendance information.
Table 8.1 — STUDENT File
| Roll Number | SName | SDateofBirth | GName | GPhone | GAddress |
|---|---|---|---|---|---|
| 1 | Atharv Ahuja | 2003-05-15 | Amit Ahuja | 5711492685 | G-35, Ashok Vihar, Delhi |
| 2 | Daizy Bhutia | 2002-02-28 | Baichung Bhutia | 7110047139 | Flat no. 5, Darjeeling Appt., Shimla |
| 3 | Taleem Shah | 2002-02-28 | Himanshu Shah | 9818184855 | 26/77, West Patel Nagar, Ahmedabad |
| 4 | John Dsouza | 2003-08-18 | Danny Dsouza | S -13, Ashok Village, Daman | |
| 5 | Ali Shah | 2003-07-05 | Himanshu Shah | 9818184855 | 26/77, West Patel Nagar, Ahmedabad |
| 6 | Manika P. | 2002-03-10 | Sujata P. | 7802983674 | HNO-13, B- block, Preet Vihar, Madurai |
Table 8.2 — ATTENDANCE File
| AttendanceDate | RollNumber | SName | AttendanceStatus |
|---|---|---|---|
| 2018-09-01 | 1 | Atharv Ahuja | P |
| 2018-09-01 | 2 | Daizy Bhutia | P |
| 2018-09-01 | 3 | Taleem Shah | A |
| 2018-09-01 | 4 | John Dsouza | P |
| 2018-09-01 | 5 | Ali Shah | A |
| 2018-09-01 | 6 | Manika P. | P |
| 2018-09-02 | 1 | Atharv Ahuja | P |
| 2018-09-02 | 2 | Daizy Bhutia | P |
| 2018-09-02 | 3 | Taleem Shah | A |
| 2018-09-02 | 4 | John Dsouza | A |
| 2018-09-02 | 5 | Ali Shah | P |
| 2018-09-02 | 6 | Manika P. | P |
8.2.1 Limitations of a File System
A file system becomes difficult to handle when the number of files increases and the volume of data grows.
(A) Difficulty in Access
Files themselves do not provide a mechanism to retrieve data. Data in a file system is accessed through application programs. While developing such programs, all possible ways of accessing data may not be anticipated. Therefore, accessing data in the required format may become difficult and an application program may have to be written.
(B) Data Redundancy
In the school example, student names occur in both STUDENT and ATTENDANCE files. Guardian information may also be repeated. For example, students with roll numbers 3 and 5 have the same guardian name.
Redundancy results in excess storage usage and may also cause data inconsistency.
(C) Data Inconsistency
If a student’s name spelling is changed, it has to be changed in both files. Similarly, when a student leaves school, the details should be deleted from both files. Since different people may maintain different files, the changes may not happen everywhere, resulting in inconsistent data.
(D) Data Isolation
STUDENT and ATTENDANCE files contain related student information, but there is no link or mapping between them in a file system.
Separate programs have to be written to access the files. In a complex system, files created by different people at different times may have different formats. This makes it difficult to retrieve information from multiple files.
(E) Data Dependence
Data is stored in a specific format or structure in a file. If that structure or format changes, all existing application programs accessing that file also need to be changed.
(F) Controlled Data Sharing
Different users such as teachers, office staff and parents may need different levels of access. Not every user should be able to access all data.
For example, guardians and office staff may be allowed to view attendance but should not be able to modify or delete it. Only the teacher should be able to update attendance data.
Enforcing such access control through application programs in a file system is difficult.
8.3 Database Management System
The limitations of a file system can be overcome by storing data in a database where data is logically related.
DBMS allows users or application programs to create a database, store data, manage data, update or modify data and retrieve data.
Examples of DBMS Mentioned in the Chapter
Database System
A database system hides certain details about how data is actually stored and maintained. It provides users with an abstract view of the data.
A database system has a set of programs through which users or other programs can access, modify and retrieve stored data.
DBMS as an Interface
DBMS serves as an interface between the database and end users or application programs.
Users can also modify the structure of a database through a DBMS.
Table 8.3 — Use of Database in Real-Life Applications
| Application | Database to Maintain Data About |
|---|---|
| Banking | Customer information, account details, loan details, transaction details, etc. |
| Crop Loan | Kisan credit card data, farmer’s personal data, land area and cultivation data, loan history, repayment data, etc. |
| Inventory Management | Product details, customer information, order details, delivery data, etc. |
| Organisation Resource Management | Employee records, salary details, department information, branch locations, etc. |
| Online Shopping | Items description, user login details, users preferences details, etc. |
8.3.1 File System to DBMS
In the school example, STUDENT and ATTENDANCE are separate files. Tables in a database can be linked or related through one or more common columns or fields.
STUDENT and ATTENDANCE have RollNumber and SName as common field names.
Changes Required to Convert the Files into a Database
(a) Remove Repeated SName from ATTENDANCE
SName need not be maintained in ATTENDANCE because it is already available in STUDENT. Student details can be retrieved using the common field RollNumber in both files.
(b) Avoid Repeated Guardian Details
If two siblings are in the same class, the same guardian details (GName, GPhone and GAddress) may be maintained for both.
This is redundancy. To avoid it, the STUDENT file can be split into STUDENT and GUARDIAN files so that each guardian’s data is maintained only once.
(c) Create GUID
More than one guardian can have the same name. Therefore, guardian name alone cannot identify which guardian is related to which student.
An additional column called GUID (Guardian ID) is created. GUID takes a unique value for each record in the GUARDIAN file and is also stored in STUDENT to relate the two files.
Guardians could also be distinguished using phone numbers, but a phone number can change and therefore may not truly distinguish a guardian.
Figure 8.1 — Record Structure of STUDENTATTENDANCE Database
RollNumber
SName
SDateofBirth
GUID
GUID
GName
GPhone
GAddress
AttendanceDate
RollNumber
AttendanceStatus
Record structure of three files in STUDENTATTENDANCE database.
Table 8.4 — Snapshot of STUDENT Table
| RollNumber | SName | SDateofBirth | GUID |
|---|---|---|---|
| 1 | Atharv Ahuja | 2003-05-15 | 444444444444 |
| 2 | Daizy Bhutia | 2002-02-28 | 111111111111 |
| 3 | Taleem Shah | 2002-02-28 | |
| 4 | John Dsouza | 2003-08-18 | 333333333333 |
| 5 | Ali Shah | 2003-07-05 | 101010101010 |
| 6 | Manika P. | 2002-03-10 | 466444444666 |
Table 8.5 — Snapshot of GUARDIAN Table
| GUID | GName | GPhone | GAddress |
|---|---|---|---|
| 444444444444 | Amit Ahuja | 5711492685 | G-35, Ashok Vihar, Delhi |
| 111111111111 | Baichung Bhutia | 3612967082 | Flat no. 5, Darjeeling Appt., Shimla |
| 101010101010 | Himanshu Shah | 4726309212 | 26/77, West Patel Nagar, Ahmedabad |
| 333333333333 | Danny Dsouza | S -13, Ashok Village, Daman | |
| 466444444666 | Sujata P. | 3801923168 | HNO-13, B- block, Preet Vihar, Madurai |
Table 8.6 — Snapshot of ATTENDANCE Table
| Date | RollNumber | Status |
|---|---|---|
| 2018-09-01 | 1 | P |
| 2018-09-01 | 2 | P |
| 2018-09-01 | 3 | A |
| 2018-09-01 | 4 | P |
| 2018-09-01 | 5 | A |
| 2018-09-01 | 6 | P |
| 2018-09-02 | 1 | P |
| 2018-09-02 | 2 | P |
| 2018-09-02 | 3 | A |
| 2018-09-02 | 4 | A |
| 2018-09-02 | 5 | P |
| 2018-09-02 | 6 | P |
Cost of Shifting from File System to DBMS
- Purchasing sophisticated hardware and software.
- Training users for querying.
- Recurrent cost for regular backup and recovery operations.
DBMS and Centralised Data
The simplified STUDENTATTENDANCE database maintains a single repository of data at a centralised location and can be used by multiple users, such as office staff and teachers, at the same time.
8.3.2 Key Concepts in DBMS
(A) Database Schema
Database schema is also called the visual or logical architecture because it tells us how data is organised in a database.
(B) Data Constraint
For example, a mobile number column can be restricted to non-negative integer values of exactly 10 digits. Since each student should have one unique roll number, NOT NULL and UNIQUE constraints can be placed on the RollNumber column.
Constraints are used to ensure accuracy and reliability of data in a database.
(C) Meta-data or Data Dictionary
Meta-data means data about the data.
(D) Database Instance
When the database structure or schema is defined, the database state is empty because there is no data entry.
Data can then be retrieved through queries or manipulated through updation, modification or deletion. Since the database state can change, one database schema can have many instances at different times.
Figure 8.2 — STUDENTATTENDANCE Database Environment
Guardian
Attendance
Catalog
Teacher and Office Staff interact with the database through DBMS.
(E) Query
A query can retrieve data from one table or from a combination of tables.
Example given in the chapter: finding the names of all students present on a particular attendance date.
To retrieve or manipulate data, the user writes a query using a query language.
(F) Data Manipulation
Modification of a database consists of three operations:
| Operation | Meaning in the Chapter Example |
|---|---|
| Insertion | Adding details when a new student joins. |
| Deletion | Removing student and guardian details when a student leaves. |
| Update | Changing information such as a guardian’s mobile number. |
(G) Database Engine
Limitations of DBMS Mentioned in the Chapter
Use of DBMS increases the complexity of maintaining functionalities such as security, consistency, sharing and integrity.
Since data is stored centrally, the chances of data loss due to hardware or software failure increase. Such failure can bring operations to a halt for all users.
8.4 Relational Data Model
Different DBMS types are classified based on their underlying data model. A data model describes the structure of a database, including how data is defined and represented, relationships among data and constraints.
The most commonly used data model is the Relational Data Model. Other data models mentioned in the chapter are:
- Object-oriented data model
- Entity-relationship data model
- Document model
- Hierarchical data model
Each table can have multiple columns, and each column name should be unique. Each row represents a related set of values.
For example, each row of the GUARDIAN relation represents a particular guardian with related values such as guardian ID, name, address and phone. Thus, a table consists of a collection of relationships.
Relations in a database are not independent tables; they are associated with each other.
ATTENDANCE has RollNumber which links it with the corresponding student record in STUDENT. GUID in STUDENT is used to obtain guardian details.
Table 8.7 — Relation Schemas and Description
| Relation Schema | Description of Attributes |
|---|---|
| STUDENT (RollNumber, SName, SDateofBirth, GUID) |
RollNumber: unique ID of the student SName: name of the student SDateofBirth: date of birth of the student GUID: unique ID of the guardian of the student |
| ATTENDANCE (AttendanceDate, RollNumber, AttendanceStatus) |
AttendanceDate: date on which attendance is taken RollNumber: roll number of the student AttendanceStatus: whether present (P) or absent (A) |
| GUARDIAN (GUID, GName, GPhone, GAddress) |
GUID: unique ID of the guardian GName: name of the guardian GPhone: contact number of the guardian GAddress: contact address of the guardian |
Relational Data Model Terminology
Attribute
Example: GUID, GName, GPhone and GAddress are attributes of the GUARDIAN relation.
Tuple
In a table with n columns, a tuple represents a relationship between the n related values.
Domain
Usually, a data type specifies the domain of an attribute. For example, RollNumber may take integer values and SName may take character strings.
Degree
Example: GUARDIAN has four attributes, so its degree is 4.
Cardinality
Example: GUARDIAN has 5 tuples, so its cardinality is 5.
Figure 8.4 — Relation GUARDIAN
| GUID | GName | GPhone | GAddress |
|---|---|---|---|
| 444444444444 | Amit Ahuja | 5711492685 | G-35, Ashok Vihar, Delhi |
| 111111111111 | Baichung Bhutia | 3612967082 | Flat no. 5, Darjeeling Appt., Shimla |
| 101010101010 | Himanshu Shah | 4726309212 | 26/77, West Patel Nagar, Ahmedabad |
| 333333333333 | Danny Dsouza | S -13, Ashok Village, Daman | |
| 466444444666 | Sujata P. | 3801923168 | HNO-13, B- block, Preet Vihar, Madurai |
Degree = 4
Cardinality = 5
It is a flat file: each column has a single value and each record has the same number of columns.
8.4.1 Three Important Properties of a Relation
Property 1 — Rules for Attributes
- Each attribute in a relation has a unique name.
- The sequence of attributes in a relation is immaterial.
Property 2 — Rules for Tuples
- Each tuple in a relation is distinct.
- No two tuples of ATTENDANCE can have identical values for all attributes.
- Each tuple must be uniquely identified by its contents.
- The sequence of tuples in a relation is immaterial.
- Tuples are not considered ordered even though they appear in tabular form.
Property 3 — Rules for the State of a Relation
- All data values in an attribute must belong to the same domain or data type.
- Each data value associated with an attribute must be atomic and cannot be further divided into meaningful subparts.
- An attribute cannot contain many data values in one tuple.
- NULL is used to represent unknown or non-applicable values.
8.5 Keys in a Relational Database
Tuples within a relation must be distinct. No two tuples should have the same value for all attributes.
There should be at least one attribute whose value is unique and not NULL so that each tuple can be uniquely distinguished.
Restrictions on attribute values and relationships between relations are specified through different types of keys.
8.5.1 Candidate Key
In GUARDIAN, GUID and GPhone are candidate keys because they take unique values.
8.5.2 Primary Key
The remaining candidate keys are called alternate keys.
8.5.3 Composite Primary Key
In ATTENDANCE, RollNumber cannot be the primary key because the same student’s roll number occurs for different dates. AttendanceDate also cannot be the primary key because the same date occurs for different students.
The combination of RollNumber and AttendanceDate is unique because a student’s attendance is marked only once on a working day.
{RollNumber, AttendanceDate} forms the composite primary key
of ATTENDANCE.
8.5.4 Foreign Key
- The referencing relation contains the foreign key.
- The relation containing the referenced primary key is called the primary or master relation.
- A foreign key may take NULL if it is not part of the primary key of the foreign table.
- The foreign key is used to refer to information in another relation.
Figure 8.5 — Primary and Foreign Keys
RollNumber
SName
SDateofBirth
GUID
GUID
GName
GPhone
GAddress
AttendanceDate
RollNumber
AttendanceStatus
RollNumber
The chapter represents foreign keys by directed arcs pointing to the corresponding primary-key attribute.
Keys — Quick Comparison
| Key | Purpose | Chapter Example |
|---|---|---|
| Candidate Key | Can uniquely identify tuples and is a candidate for primary key. | GUID, GPhone |
| Primary Key | Selected candidate key used to uniquely identify tuples. | GUID when selected in GUARDIAN |
| Alternate Key | Candidate key not selected as primary key. | GPhone when GUID is primary key |
| Composite Primary Key | More than one attribute together uniquely identifies tuples. | RollNumber + AttendanceDate |
| Foreign Key | Represents relationship between two relations. | GUID / RollNumber relationships shown in STUDENTATTENDANCE |
Chapter Summary
- A file in a file system is a container used to store data in a computer.
- File systems suffer from Data Redundancy, Data Inconsistency, Data Isolation, Data Dependence and Controlled Data Sharing limitations.
- DBMS is software used to create and manage databases.
- A database contains related tables.
- Database schema is the design of a database.
- A database constraint is a restriction on the type of data that can be inserted into a table.
- Database schema and constraints are stored in the database catalog.
- A database instance is the snapshot/state of a database at a particular time.
- A query is a request to a database for information retrieval and data manipulation.
- Data manipulation includes insertion, deletion and update.
- The relational DBMS stores data in related tables.
- Rows and columns of a table are called tuples and attributes respectively.
- A table is called a relation.
- Candidate Key, Primary Key, Composite Primary Key and Foreign Key are important keys.
- Primary key uniquely identifies tuples in a relation.
- Foreign key is used to relate two tables or relations.
- Each column represents an attribute.
- Each row represents a record or tuple.
- Degree is the number of attributes in a relation.
- Cardinality is the number of tuples in a relation.
- SQL is identified in the chapter as the standard language for RDBMS systems such as MySQL.
Questions & Answers
1-Mark Questions
A file is a container used to store data in a computer.
Data redundancy means duplication of the same data in different places or files.
Data inconsistency occurs when the same data maintained in different places does not match.
DBMS is software used to create and manage databases.
Database schema is the design or skeleton of a database representing its structure.
Meta-data is data about the data.
It is the state or snapshot of a database at any given time after data has been loaded.
A query is a request to a database for obtaining information in a desired way.
An attribute is a characteristic or parameter for which data is stored in a relation; it represents a column.
A tuple is a row of data in a relation.
Degree is the number of attributes in a relation.
Cardinality is the number of tuples in a relation.
A primary key is the candidate key selected to uniquely identify tuples in a relation.
A foreign key is an attribute used to represent a relationship between two relations.
2-Mark Questions
Any two are: repeated entry of student details in new registers, inconsistency due to incorrectly written or skipped records, loss of data if a register is lost/damaged, and erroneous manual calculations.
Data redundancy is duplication of the same data in different files or places. It causes excess storage usage and may lead to data inconsistency.
Data dependence occurs when application programs depend on the structure or format of stored data. If the file structure changes, the programs accessing it also need modification.
They are Insertion, Deletion and Update.
| Degree | Cardinality |
|---|---|
| Number of attributes in a relation. | Number of tuples in a relation. |
When no single attribute can uniquely distinguish tuples, more than one attribute is taken together as the primary key. Such a key is called a composite primary key.
3-Mark Questions
Difficulty in Access: Files do not provide a direct mechanism for retrieving data and application programs are required.
Data Redundancy: The same data may be duplicated in different files, increasing storage usage and possibly causing inconsistency.
Data Inconsistency: The same data in different places may not match if changes are not made in every file.
A candidate key is an attribute capable of uniquely identifying tuples and is a candidate for primary key. The database designer selects one candidate key as the primary key. The remaining candidate keys become alternate keys.
Attribute: A column or characteristic of a relation.
Tuple: A row in a relation.
Domain: Set of values from which an attribute can take values.
Degree: Number of attributes.
Cardinality: Number of tuples.
4/5-Mark Questions
The limitations described in the chapter are Difficulty in Access, Data Redundancy, Data Inconsistency, Data Isolation, Data Dependence and Controlled Data Sharing. Each limitation makes storing, retrieving, maintaining or controlling data difficult as the amount of data grows.
STUDENT and ATTENDANCE can be related through common fields. SName need not be repeated in ATTENDANCE. Guardian details can be separated into a GUARDIAN relation to reduce redundancy. GUID can be introduced to uniquely identify guardians and relate STUDENT and GUARDIAN.
Candidate Key, Primary Key, Alternate Key, Composite Primary Key and Foreign Key are described in the chapter. Candidate keys can uniquely identify tuples; one candidate key is selected as the primary key; remaining candidates are alternate keys; multiple attributes can form a composite primary key; and a foreign key connects related relations.
📝 Important Questions
1 Mark
- Define file.
- What is data redundancy?
- What is data inconsistency?
- Define DBMS.
- What is a database schema?
- What is meta-data?
- Define database instance.
- What is a query?
- Define attribute.
- Define tuple.
- What is domain?
- Define degree and cardinality.
- What is a candidate key?
- What is a primary key?
- What is a foreign key?
2 Marks
- State the limitations of manual record keeping.
- Explain data redundancy.
- Explain data inconsistency.
- Explain data dependence.
- What are insertion, deletion and update?
- Differentiate degree and cardinality.
- What is a composite primary key?
- Why are constraints used in a database?
3 Marks
- Explain the limitations of a file system.
- Explain candidate key and primary key.
- Explain attribute, tuple and domain.
- Explain degree and cardinality with examples.
- Explain the three important properties of a relation.
4/5 Marks
- Explain how a file system can be converted into a DBMS-based database.
- Explain the important concepts in DBMS.
- Explain the relational data model and its terminology.
- Explain the different types of keys in a relational database.
- Explain the three important properties of a relation.
Textbook Exercise — Chapter 8
1. Give the terms for each of the following
- Collection of logically related records.
- DBMS creates a file that contains description about the data stored in the database.
- Attribute that can uniquely identify the tuples in a relation.
- Special value stored when actual data value is unknown for an attribute.
- An attribute which can uniquely identify tuples of the table but is not defined as primary key.
- Software used to create, manipulate and maintain a relational database.
2.
Why are foreign keys allowed to have NULL values? Explain with an example.
3. Differentiate between
- Database state and database schema
- Primary key and foreign key
- Degree and cardinality of a relation
4.
Compared to a file system, how does a database management system avoid redundancy in data through a database?
5.
What are the limitations of file system that can be overcome by a relational DBMS?
6. Sports Preferences
| Roll_no | Preference |
|---|---|
| 9 | Cricket |
| 13 | Football |
| 17 | Badminton |
| 17 | Football |
| 21 | Hockey |
| 24 | NULL |
| NULL | Kabaddi |
- Roll no 24 may not be interested in sports. Can a NULL value be assigned to that student’s preference field?
- Roll no 17 has given two preferences in sports. Which property of relational DBMS is violated? Can a constraint or key be used to check against such violation?
- Kabaddi was not chosen by any student. Is it possible to have this tuple in the Sports Preferences relation?
7. Sports Preferences of Two Sections
Section 1
| Roll_no | Sports |
|---|---|
| 9 | Cricket |
| 13 | Football |
| 17 | Badminton |
| 21 | Hockey |
| 24 | Cricket |
Section 2
| Sports | Roll_no |
|---|---|
| Badminton | 17 |
| Cricket | 9 |
| Cricket | 24 |
| Football | 13 |
| Hockey | 21 |
Are the states of both relations equivalent? Justify.
8. School Canteen Database
The school canteen wants to maintain records of items available and generate bills when students purchase items. The database should track items and items purchased by students.
- To store each item name along with its price, what relation should be used? Decide appropriate attribute names and data types. Each item and its price should be stored only once. What restriction should be used?
-
To generate a bill, quantity of an item purchased is required. Should this
information be in a new relation or part of the previous relation?
If a new relation is required, decide its name and data types and identify
primary and foreign keys satisfying the given restrictions.
- The same bill cannot be generated for different orders.
- A bill can be generated only for available items in the canteen.
- The school wants to find how many calories students intake when they order an item. In which relation should the attribute calories be stored?
9. EMP-DEPENDENT Database
- Name the attributes of EMPLOYEE which can be used as candidate keys.
- The company wants to retrieve details of a dependent of a particular employee. Name the tables and key required to retrieve this detail.
- What is the degree of EMPLOYEE and DEPENDENT relation?
10. School Uniform Database
Attributes and Constraints
| Table | Attribute | Constraints |
|---|---|---|
| UNIFORM | UCode, UName, UColor | Primary Key, Not Null, – |
| COST | UCode, Size, Price | Composite Primary Key, >0 |
UNIFORM
| UCode | UName | UColor |
|---|---|---|
| 1 | Shirt | White |
| 2 | Pant | Grey |
| 3 | Skirt | Grey |
| 4 | Tie | Blue |
| 5 | Socks | Blue |
| 6 | Belt | Blue |
COST
| UCode | Size | Price |
|---|---|---|
| 1 | M | 500 |
| 1 | L | 580 |
| 1 | XL | 620 |
| 2 | M | 810 |
| 2 | L | 890 |
| 2 | XL | 940 |
| 3 | M | 770 |
| 3 | L | 830 |
| 3 | XL | 910 |
| 4 | S | 150 |
| 4 | L | 170 |
| 5 | S | 180 |
| 5 | L | 210 |
| 6 | M | 110 |
| 6 | L | 140 |
| 6 | XL | 160 |
-
Can the following tuples be inserted into UNIFORM? Give reasons:
- 7, Handkerchief, NULL
- 4, Ribbon, Red
- 8, NULL, White
-
Can the following tuples be inserted into COST? Give reasons:
- 7, S, 0
- 9, XL, 100
11. Multiplex Database
- Is it correct to assign Movie_ID as the primary key in MOVIE? If no, suggest an appropriate primary key.
- Is it correct to assign AudiNo as the primary key in AUDI? If no, suggest an appropriate primary key.
- Is there any foreign key in any of these relations?
12. STUDENT-PROJECT Database
Answer the following:
- Name the primary key of each table.
- Find foreign key(s) in PROJECT-ASSIGNED.
- Is there any alternate key in STUDENT? Give justification.
- Can a user assign duplicate value to RollNo of STUDENT? Justify.
PROJECT
| ProjectNo | PName | SubmissionDate |
|---|---|---|
| 101 | Airline Database | 12/01/2018 |
| 102 | Library Database | 12/01/2018 |
| 103 | Employee Database | 15/01/2018 |
| 104 | Student Database | 12/01/2018 |
| 105 | Inventory Database | 15/01/2018 |
| 106 | Railway Database | 15/01/2018 |
PROJECT-ASSIGNED
| Registration_ID | ProjectNo |
|---|---|
| IP-101-15 | 101 |
| IP-104-15 | 103 |
| CS-103-14 | 102 |
| CS-101-14 | 105 |
| CS-101-10 | 104 |
STUDENT
| Roll No | Name | Class | Section | Registration_ID |
|---|---|---|---|---|
| 11 | Mohan | XI | 1 | IP-101-15 |
| 12 | Sohan | XI | 2 | IP-104-15 |
| 21 | John | XII | 1 | CS-103-14 |
| 22 | Meena | XII | 2 | CS-101-14 |
| 23 | Juhi | XII | 2 | CS-101-10 |
13. STUDENT-PROJECT Database Operations
Can the following operations be performed?
- Insert a student record with missing roll number value.
- Insert a student record with missing registration number value.
- Insert a project detail without submission-date.
- Insert a record with registration ID IP-101-19 and ProjectNo 206 in PROJECT-ASSIGNED.
⚡ Quick Revision
- File
- DBMS
- Database Schema
- Data Constraint
- Meta-data
- Database Instance
- Query
- Attribute
- Tuple
- Domain
- Degree
- Cardinality
- Candidate Key
- Primary Key
- Composite Primary Key
- Foreign Key
- Difficulty in Access
- Data Redundancy
- Data Inconsistency
- Data Isolation
- Data Dependence
- Controlled Data Sharing
- Insertion
- Deletion
- Update
- Column = Attribute
- Row = Tuple
- Number of attributes = Degree
- Number of tuples = Cardinality
- Table = Relation
- Candidate Key
- Primary Key
- Alternate Key
- Composite Primary Key
- Foreign Key
- MySQL
- Oracle
- PostgreSQL
- SQL Server
- Microsoft Access
- MongoDB
Important Comparison — Degree vs Cardinality
| Basis | Degree | Cardinality |
|---|---|---|
| Meaning | Number of attributes. | Number of tuples. |
| Represents | Columns. | Rows. |
| GUARDIAN example | 4 | 5 |
Important Comparison — Primary Key vs Foreign Key
| Primary Key | Foreign Key |
|---|---|
| Uniquely identifies tuples in a relation. | Represents a relationship between two relations. |
| Selected from candidate keys. | Refers to the primary key of another relation. |
| Defined in the primary/master relation. | Present in the referencing/foreign relation. |
Important Formulas / Structural Facts
Degree = Number of attributes in a relation
Cardinality = Number of tuples in a relation
GUARDIAN Degree = 4
GUARDIAN Cardinality = 5
Important Relation Schemas
Important Composite Key
This combination forms the composite primary key of ATTENDANCE according to the chapter example.
Important Diagram to Revise
Related data structure of the STUDENTATTENDANCE database.
🎯 Final Revision
Remember These Points
- Manual record keeping becomes difficult as the volume of data increases.
- A file is a container for storing data.
- File systems have important limitations including redundancy, inconsistency, isolation and dependence.
- DBMS is software for creating and managing databases.
- DBMS provides an interface between users/application programs and databases.
- Database schema represents the design and structure of a database.
- Constraints restrict the type of data that can be inserted.
- Meta-data is data about data.
- Database instance is the state/snapshot of a database at a particular time.
- Query is a request for information from a database.
- Insertion, deletion and update are data manipulation operations.
- Relational model represents data through related tables called relations.
- Columns are attributes and rows are tuples.
- Degree counts attributes; cardinality counts tuples.
- Candidate keys can uniquely identify tuples.
- One candidate key is selected as the primary key.
- A candidate key not selected as primary key becomes an alternate key.
- More than one attribute together can form a composite primary key.
- A foreign key represents a relationship between relations.
- NULL represents an unknown or non-applicable value.