Database Management
Database Management
Information
Information is the processed or organized form of
data. If data is not correct or accurate, the
information obtained by processing such data
may not be correct. For example, marks obtained
by students and their roll numbers is the data,
while the report card/sheet is the information.
Other forms of information are pay-slips,
schedules, worksheet, bar charts, invoices,
account returns etc
Data Types
The nature of data to be entered for various
fields are of different types. For example, names
are stored in the form of text, age in numbers,
fees in decimal numbers, date of birth in date
format and so on. A data type refers to the type
of data that will be stored in that particular field.
The memory size of a field varies according to its
data type.
Text Data Type – The text data is a combination of
letters, numbers or special characters. No
arithmetic calculations can be performed on text
data. Examples of text data type is PAN Card
Number, Name, Marks, etc.
Editing A Table
Editing a table involves the task such as adding a
new field or removing any field in a table or to
alter any of the field properties. To edit a table,
open the Database User Interface window.
Selecting the Table object in Database Pane, the
list of tables will be displayed in the Table Area.
Right click on the table name and select Edit
option from the pop menu.
Deleting A Table
To delete a table, right click on the table to be
deleted, say Customer table and select the
Delete option from the pop-up menu. A
confirmation box to confirm for deletion of the
table will be displayed. Click on Yes button to
finally delete the table.
Renaming A Table
To rename a table, right click on the table name
in the Table Area and select Rename option from
the pop-up menu. A cursor will appear. Type the
new name and press the Enter key
Types of Relationships
The type of relationship between any two tables
in a database is based on the number of records
that are present in the transaction table
corresponding to the master table. Primarily
three types of relationships can be set up
between two tables in a relational database
These are:
(i) One-to-One
(ii) One-to-many
(iii) Many-to-Many
One-to-One relationship
In this type of relationship, one specific record of
a master table has one and only one
corresponding record in the transaction table.
For Ex: The record for Admission_No in the
master table (Student_Detail) will have only one
corresponding record of same value of Admission
No in the transaction table of Student_ Result.
This is because no two students will be given
same admission number.
One-to-Many relationship
This is one of the most common types of
relationship between the tables in a database. As
the name says, in this type of relationship, one
specific record of the master table has more than
one corresponding records in the related
transaction table.
For Ex: one teacher can teach multiple students
or multiple classes, or one person can sell
multiple products. So we can say that there is a
one to many relationship between a teacher and
class or teacher and student or seller and
products.
Many-to-Many relationship
In this type of relationship, there will be multiple
records in the master table that correspond to
multiple records in the transaction table as well.
Generally this type of relationship is set when
certain records have to be saved more than once
in both the related tables.
For Ex: a teacher in a school may hold multiple
responsibilities such as class teacher, an activity
in charge or examination in-charge. For each
responsibility the teacher might be attached with
multiple students. So, this type of relationship
will be many to many relationship.
Advantages of Relating Tables in a Database
There are various advantages of relating tables
in a
database. Few of them are as given below.
• A relationship can help prevent data
redundancy.
• It helps prevent missing data by keeping
deleted data from getting out of synch. This is
called referential integrity.
• Creating relationships between tables restricts
the user from entering invalid data in the
referenced fields.
• Any updation in the master table is
automatically
reflected in the transaction tables.
Referential Integrity
According to the principle of referential integrity,
no unmatched foreign key values should exist in
the database.
LibreOffice Base gives us following four options to
choose from to maintain referential integrity in
such cases.
• No action – This is the default option. This
option states that a user should not be allowed to
update or delete any record in the master table if
any related record exists in the transaction table.
• Update cascade – This option allows the user
to delete or update the referenced field but along
with it all the related records in any of the
transaction tables will also be deleted or
updated.
• Set NULL – This option assigns NULL value to
all the related fields if the master record is
deleted or updated.
• Set default – This option assigns any fixed
default value to all the related fields if the master
record is deleted or updated.