Introduction to DBMS textbook
Introduction to DBMS textbook
IntroductIon
Databases and database systems are essential parts of
our life. We have been interacting with databases since
a time. Recall the process of looking for a word in a
dictionary or finding the telephone number of a friend
from the telephone directory. With the advancement
in ever changing technology, computerized databases
are being used to store, manipulate, and manage the
database. Today, we use databases in almost all spheres
of life. When we go to book railway tickets, to search
for a book in a library, to get the salary details, to get
the balance amount after withdrawal of money from the
ATM and so on, this list can run into several pages. Data
being stored in databases can be of varied types like
text, images, audio and video. This data is then stored
and/or processed so as to get meaningful information.
2023-24
information. Other forms of information are pay-slips, notes
schedules, worksheet, bar charts, invoices, account
returns etc. Similarly the temperature recorded is data
which can be processed to find out the maximum or
minimum temperature of day and night. Also this data
is generally organised in tabular form as shown in the
Table 8.1.
Table 8.1: Data Stored in Tabular Form
Sunday 35 15
Monday 37 17
Tuesday 36 16
Wednesday 34 15
Thursday 35 17
Friday 35 16
Saturday 33 14
2023-24
Let us discuss some of the advantages of DBMS:
• Organised Storage – The data in the database is
stored in an organised manner, so that retrieval
of the required data is fast and accurate.
• Data Analysis – A database helps in analysis of
data based on certain criteria. It is easy to find
out maximum or minimum value, average or
mean using a database.
• Data Sharing – If the same data set is required
for different applications then the database can
be shared with other applications. Hence using
a database means making once and using it
repeatedly for multiple applications.
• Minimal Data Redundancy – In the event of
requiring the same data field in several tables the
data field might get repeated in number of tables.
This is called as data redundancy. This can be
reduced by using DBMS tools.
• Data Consistency – By minimising data
Data Consistency: By
minimizing data redundancy,
redundancy, chances of inconsistent data being
the chances of storing stored is reduced. For example, it should not
inconsistent data are reduced. happen that the name of the student is changed in
For instance, if a student's one table and not in another. Such inconsistency
name is changed, a DBMS is reduced by using a DBMS.
can automatically reflect this
Let us consider a situation where, for example,
change in all related tables by
setting a relation between Murugan looks after the data management of ABC
them, preventing the name School. There are two tables in his database– Admission
from being updated in one table and Library table. ‘Ram Lal Kumar’ wants to
table but not another. change his name to ‘Ram Kumar’ has recently shifted
his house. So, he hands over the application for the
same to Murugan. In the absence of a DBMS, Murugan
has to change the name of the student separately in the
admission table and also in the library table. But as we
can set a relation between the two tables using a DBMS,
any change in one table is automatically reflected in
all the related tables. There is no need to add another
record with the changed name. The same record will
be updated. Hence, this reduces the chances of data
redundancy and inconsistency.
Admission Table
Roll Number Student Name Class Date of Birth Date of Admission
913 Dipak Kumar 10 06/04/2004 25/06/2018
914 Ram Lal Kumar 10 01/03/2004 24/06/2018
2023-24
Library Table
Student Name Name of the Book Date of Borrow Date of Return
Dipak Kumar IT 10/12/2018 25/12/2018
Ram Lal Kumar Science 11/11/2018 24/11/2018
Sham Lal Mathematics 12/11/2018 30/12/2018
Data Models
A database can be designed in different ways depending
on the data being stored. This structure of database A data model is the structure of a
database that describes the manner in
is known as data model that describes the manner in which data will be stored and retrieved. A
which data will be stored and retrieved. database can be designed in different
A data model consists of components for describing ways depending on the data being
stored, and this structure is known as a
the data, relationships among them and the constraints data model.
that hold data. There are different data models such Data Model- It describes the manner in
as hierarchical data model, network data model and which data will be stored and retrieved.
relational data model.
2023-24
notes All these records are linked to each other at various
levels, thereby forming a hierarchy. For example, in
Fig. 8.1 the data of a company is stored using a
hierarchical data model.
problem: rigidity and cant
Likes Ltd. be flexible
Personal Project
Information Information
2023-24
Relational Database Model notes
The Relational Database Model was proposed in 1970
by E. F. Codd. Relational database model is the most
common type of database model. The data elements are
stored in different tables made up of rows and columns.
The data in different tables are related through the use
of common fields. So relations are set between tables
based on common fields. That is why this model is
termed as relational database model.
2023-24
alphanumeric form. Examples of data values are
‘Abhinav Bindra’, ‘26’ ‘shooting’, “Chandigarh”,
“10-12-2018”, etc.
• Record or Row – The data values for all the fields
A record, also known as a row, is the collection
of data values for all the fields related to a related to a person or object is called a record. It is
single person or object, presented as a row presented as rows within a table. A record holds
within a table the data values of all the fields for a single person
or object in a table. For example, in the Employee
table with the field names as Name, Designation,
Department, the data values of all the fields for an
employee may be (‘Abhinav’, ‘Manager’, ‘Finance’)
A primary key or simply a key is and this forms one record.
a field that uniquely identifies a row in a • Primary Key – A primary key or simply a key is
table. a field that uniquely identifies a row in a table.
•It acts as a unique identifier for the table. The key identifier can be the value of a single
column or of multiple columns. The primary key
•The value of the primary key must be is a unique identifier for the table. The column or
unique for each different row. This means no combinations of columns that form the primary
two rows in the table can have the same key have unique values. At any time, no two rows
value for the primary key at any time.
in the table can neither have same values for the
•Also, the primary key field cannot be left primary key nor can data value for such field be
blank left blank. For example, in a student table, each
student has a unique roll no., which forms the
If, in a table we use more than one primary key. If, in a table we use more than one read the
fields to identify a record, it is known as a
fields to identify a record, it is known as a composite examples
composite
key. key. For example, we may form a composite key
consisting of fields roll no. and name.
• Relational Database – A relational database is
a collection of related tables. For example, in
Fig. 8.3, the database contains two related tables.
Relational Database
Fields
fields
Roll Number Student Name Class Date of Birth Date of Admission
913 Dipak Kumar 10 06/04/2004 25/06/2018
record 914 Ram Lal Kumar 10 01/03/2004 24/06/2018
2023-24
• Foreign Key – If a field or a combination of fields
of one table can be used to uniquely identify
records of another table, then that particular field Helps build the relation between
is known as the foreign key. This foreign key helps the tables
to build a relation between two tables. Consider
the example given below.
Student Registration Table
Enrolment Number Student Name Class Date of Birth Date of Admission
XX1234567890 Dipak Kumar 10 06/04/2004 25/06/2018
XX1234567891 Ram Kumar 10 01/03/2004 24/06/2018
Primary key: Enrollment Number
Student Marks Table
builds relation
Roll Number Maths Science Vocational Enrolment Number
44983 87 75 80 XX1234567890
44990 74 45 75 XX1234567891
Primary key – Roll Number, Foreign key – Enrollment Number
A primary key uniquely identifies records
within a table, while foreign key establishes
In Student Registration Table, ‘Enrolment_Number’ relationships between tables by referencing
is the primary key and in the Student Marks Table, the primary key of another table.
‘Roll_Number’ is the primary key, whereas ‘Enrollment_
Number’ is the foreign key. This foreign key can be used
to set a relation between two tables.
• Candidate Key – All the field values that are
eligible to be the primary key are the candidate
keys for that table. Such fields can neither be left
blank nor can have duplicate values. So in the
table Student Marks, Enrollment Number and
Roll Number both are candidate keys.
• Alternate Key – Out of the candidate keys, one
or two are made as primary keys. The others are
the alternate keys. Hence, if Roll Number is made
as the primary key, Admission Number is the
Alternate key.
Objects of an RDBMS
An object in a database is a structure or a feature that
is used to store, represent or retrieve data. In fact a building blocks
database is a collection of these objects that work on
multiple sets of data related to each other. Various
objects in a database are as discussed below:
• Table – As mentioned before, a table is the basic
unit of any DBMS. The data is first stored in tables
Database ManageMent systeM Using LibreOffice Writer 151
2023-24
notes in row and column format. A column represents
a field or an attribute while a row represents
a record.
• Forms – A form is a feature of a database using
which we can enter data in a table in an easy
and user friendly manner. A form consists of text
boxes, labels, radio buttons, list boxes, check
boxes etc. that give a user friendly interface for
entering data. The data entered through the forms
is stored in tables.
• Queries – A query is used to retrieve the desired
information from the database. In simple terms,
it is a question asked from the database. For
example, if we want to view the names of only
those students who have scored more than
50 marks, then we post a query. The data set
matching the given criterion is retrieved from the
table and displayed on the screen.
• Reports – The output of a query may be displayed
in the form of reports. The usual result of the
query is in the form of rows and columns. But
if we want the report to be formal and in proper
layout, then we can use the Reports feature
of RDBMS.
Let’s Practice
Consider the following table and answer the questions that
follow.
Item Discount
Name Price Quantity
No. (in%)
A001 Pen 20 12 0
A003 Pencil 15 5 1
A010 Notebook 50 25 5
From the above table, identify the primary key. Justify
your choice.
How many fields and how many records does the table have?
summary
• The raw facts constitutes data.
• Information is the processed or organised form
of data.
• A database is a collection of logically related data
items stored in an organised manner.
152 Domestic Data entry operator – class X
2023-24
• The software that is used to create, update and notes
retrieve data is known as database management
system (DBMS).
• Some of the common examples of DBMS are MS
Access, Open Office or LibreOffice Base, Oracle,
Ingress, MySQL.
• Data Model is the structure of database and it
describes the manner in which data will be stored
and retrieved.
• There are different data models, such as
hierarchical data model, network data model and
relational data model.
• In Hierarchical Data Model, the data is organised
into a tree like structure. The data is stored in the
form of linked records.
• In Network Data model, multiple records are
linked to same master file.
• The Relational data model is based on the
principle of setting relationships between two or
more tables of the same database.
• Entity is a real world object about which
information is to be stored in a database.
• The details associated with the entity are called
attributes.
• A table is a collection of logically related records.
It is organised as a set of columns, and can have
any number of rows.
• A field is the smallest entity in the database.
These are individual record characteristics and
are presented as columns within a table.
• Data values are the raw data represented in
numeric, character or alphanumeric form.
• The data values for all the fields related to a
person or object is called a record. It is presented
as rows within a table.
• A primary key is a field that uniquely identifies a
row in a table.
• This foreign key helps to build a relation between
two or more tables in a database.
• All the field values that are eligible to be the
primary key are the candidate keys for that table.
2023-24
notes • Out of the candidate keys, one or two are made as
primary keys. The others are the alternate keys.
• An object in a database is a structure or a feature
that is used to store, represent or retrieve data.
The various objects in a database are tables,
forms, reports and queries.
• A form is a feature of a database using which
we can enter data in a table in an easy and user
friendly manner.
• A query is used to retrieve the desired information
from the database.
• The output of a query may be displayed in the
form of reports.
2023-24
6. A __________ is represented as rows in a table. notes
(a) field
(b) attribute
(c) record
(d) candidate key
7. In which of the following forms can a data value be
represented?
(a) Numeric
(b) Character
(c) Alphanumeric
(d) All of the above
8. Which of the following uniquely identifies a row in a table?
(a) Primary key
(b) Alternate key
(c) Foreign key
(d) Candidate key
9. A ___________is a feature of a database using which we can
enter data in a table in an easy and user friendly manner.
(a) query
(b) report
(c) form
(d) field
10. A _____________ is a question asked from a database.
(a) query
(b) report
(c) form
(d) field
2023-24
notes D. Answer the following questions
2023-24