Chap 7 Database Concepts
Chap 7 Database Concepts
Concepts 7
In this chapter
»» Introduction
»» File System
“Inconsistency of your mind… Can damage »» Database Management
System
your memory… Remove the inconsistent
»» Relational Data Model
data… And keep the original one !!!” »» Keys in a Relational
Database
— Nisarga Jain
7.1 Introduction
After learning about importance of data in the
previous chapter, we need to explore the methods
to store and manage data electronically. Let us
take an example of a school that maintains data
about its students, along with their attendance
record and guardian details.
The class teacher marks daily attendance of the
students in the attendance register. The teacher
records ‘P’ for present or ‘A’ for absent against
each student’s roll number on each working day.
If class strength is 50 and total working days in
2020-21
2020-21
2020-21
2020-21
2020-21
2020-21
2020-21
2020-21
ry
Query Result
Qu
Query Result
e
Qu
er
y
Student
Database
Guardian Catalog
Attendance
2020-21
2020-21
Table 7.7 Relation schemas along with its description of Student Attendance
database
Relation Scheme Description of attributes
STUDENT(RollNumber, RollNumber: unique id of the student
SName, SDateofBirth, SName: name of the student
GUID) SDateofBirth: date of birth of the student
GUID: unique id of the guardian of the student
ATTENDANCE AttendanceDate: date on which attendance is taken
(AttendanceDate, RollNumber: roll number of the student
RollNumber, AttendanceStatus: whether present (P) or absent(A)
AttendanceStatus) Note that combination of AttendanceDate and RollNumber will be unique
in each record of the table
GUARDIAN(GUID, GUID: unique id of the guardian
GName, GPhone, GName: name of the guardian
GAddress) GPhone: contact number of the guardian
GAddress: contact address of the guardian
2020-21
Relation
State
101010101010 Himanshu Shah 9818184855 26/77, West Patel Nagar, Ahmedabad
333333333333 Danny Dsouza S -13, Ashok Village, Daman
466444444666 Sujata P. 7802983674 HNO-13, B- block, Preet Vihar, Madurai
2020-21
2020-21
2020-21
Figure 7.2: StudentAttendance Database with the Primary and Foreign keys
Summary
• A file in a file system is a container to store data in a
computer.
• File system suffers from Data Redundancy, Data
Inconsistency, Data Isolation, Data Dependence and
Controlled Data sharing.
• Database Management System (DBMS) is a software
to create and manage databases. A database is a
collection of tables.
• Database schema is the design of a database
• A database constraint is a restriction on the type of
data that that can be inserted into the table.
• Database schema and database constraints are stored
in database Catalog.
2020-21
Exercise
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.
2. Why foreign keys are allowed to have NULL values? Explain
with an example.
2020-21
2020-21
2020-21
2020-21
Table: 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
Table: PROJECT ASSIGNED
22 Meena XII 2 CS-101-14
Registration_ID ProjectNo
23 Juhi XII 2 CS-101-10
IP-101-15 101
Table: PROJECT IP-104-15 103
ProjectNo PName SubmissionDate CS-103-14 102
101 Airline Database 12/01/2018 CS-101-14 105
102 Library Database 12/01/2018 CS-101-10 104
103 Employee Database 15/01/2018
104 Student Database 12/01/2018
105 Inventory Database 15/01/2018
106 Railway Database 15/01/2018
2020-21