0% found this document useful (0 votes)
14 views16 pages

Rdbms New

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views16 pages

Rdbms New

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Part B /Unit 3: Database Management System using LibreOffice Base

Management of data is of prime importance for any organisation. The ease of entering data, its efficient storage,
accurate and fast retrieval is the primary objective of any database management system. In this unit you will learn
about various methodologies of data management using LibreOffice Base, which is an open source application.

Chapter: 1 Introduction to Database Management System

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.

Data and Information

The raw facts constitutes data. The facts may be related to any person, place, activity or things. It may be stored in the
form of text, graphics, audio or video. This data must be processed by any computing machine in a proper way to
generate the useful and meaningful information. The examples of data are marks scored by the students, weights,
prices, costs, numbers of items sold, employee names, product names, addresses, tax codes, registration, marks etc.

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 2023-24 Database ManageMent systeM Using LibreOffice Writer 145 information.
Other forms of information are pay-slips, 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.

Databases and DBMS

A database is a collection of logically related data items stored in an organised manner. The information being stored
in a database can be added, modified, deleted or displayed according to the requirements of the user. The software
that is used to create, update and retrieve data is known as database management system (DBMS). It facilitates
planning and maintenance of the database for the user.

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 redundancy, chances of inconsistent data being stored is reduced. For
example, it should not happen that the name of the student is changed in one table and not in another. Such
inconsistency is reduced by using a DBMS.

• Increases Efficiency – Since database tables are properly organised, saving, reading and searching data can be carried
out efficiently.
• Increases Accuracy – Since data redundancy and inconsistency can be minimised in a database, the data is retrieved
accurately from the database.

• Increases Validity – Properties of different data fields can be assigned when a database is planned. So whether or
not valid data is being entered can be checked at the data entry stage. This increases the validity of the database. For
instance, we may set up a restriction while creating the table that the amount of fees being entered should be more
than 1000.

• Security – Unauthorised access can be controlled by assigning passwords to the users. The data might be translated
in such a manner that unauthorised users are not able to read it. This is known as encryption. Both these measures
increase the security of the database.

Data Models

A database can be designed in different ways depending on the data being stored. This structure of database is known
as data model that describes the manner in which data will be stored and retrieved. A data model consists of
components for describing the data, relationships among them and the constraints that hold data. There are different
data models such as hierarchical data model, network data model and relational data model.

1. Hierarchical Data Model

In this model the data is organized into a tree like structure. The data is stored in the form of records. A record is a
collection of fields and its data values. All these records are linked to each other at various levels, thereby forming a
hierarchy.

2. Network Data Model

In this model, multiple records are linked to same master file. It is also considered as an inverted tree where master is
present in the bottom of the tree and the branches contain information linked to the master.
3. Relational Data Model

This data model is based on the principle of setting relationships between two or more tables of the same database.
It is the most commonly used database model. 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.

Relational Database Terminology

Let us get familiar with some of the common terms used in RDBMS.

• Entity – It is a real world object about which information is to be stored in a database. For example, if we want to
store information about an entity Student in a school, then we need to have his admission number, roll number, name,
father’s name, date of birth, etc. These details associated with the entity are called attributes. Each entity is a collection
of these attributes associated with it. So roll number, name, admission number, etc., are attributes associated with
the entity student. These attributes are represented in the form of columns.

• Table – A table is a collection of logically related records. It is organised as a set of columns, and can have any number
of rows. For example, the Employee table can have columns, namely name, designation, department and have records
or rows having data of 100 employees.

• Field or Columns or attributes – A field is the smallest entity in the database. A collection of fields make a record, a
collection of records make a table and a collection of tables make a database. Fields are individual record
characteristics and are presented as columns within a table. Data values are stored in a database as fields. A field holds
the data values of one type of data for several persons. For example, in the Employee table the field “Emp Name” will
hold the names of employees of an organisation.

• Data Values – Data values are the raw data represented in numeric, character or 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 related to a person or object is called a record. It is presented as
rows within a table. A record holds 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’) and this forms one record.

• Primary Key – A primary key or simply a key is a field that uniquely identifies a row in a table. The key identifier can
be the value of a single column or of multiple columns. The primary key is a unique identifier for the table. The column
or combinations of columns that form the primary key have unique values. At any time, no two rows in the table can
neither have same values for the primary key nor can data value for such field be left blank. For example, in a student
table, each student has a unique roll no., which forms the primary key. If, in a table we use more than one fields to
identify a record, it is known as a composite 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,


• 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 is known as the foreign key. This foreign key helps to build a relation between two
tables. Lets us draw an example.

• 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 database is
a collection of these objects that work on multiple sets of data related to each other. Various objects in a database are

• Table – A table is the basic unit of any DBMS. The data is first stored in tables 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.

• 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.

Chapter 2 : Starting with LibreOffice Base

IntroductIon

Data has to be stored in an organised manner using a DBMS. Also, the data being stored can be a text, number, date
or in any other form. So, we need to understand different types of data that can be stored in a table. The data types
of the fields have to be specified while creating tables in a database. Thereafter valid data is entered and stored in a
table.

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.

Some commonly used data types are as follows:

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.
Numeric Data Type – Numeric data types consists of numbers. The numbers can be integer or real numbers on which
any type of arithmetic calculations can be performed. For example, 10, -34.8, 90.6789 , -86 are of numeric data type.
Different numeric data types along with the number of bits/bytes it uses and its range.

Currency Data Type – The currency data type indicates the monetary values and can be stored using currencies of
various countries. For example $100, £ 500 or Rs. 25.50.

• Date Data Type – This data type is used to indicate dates and time. For example 12/25/2019, 08:45 AM. The data
and time can be stored in various formats.

Boolean – In boolean data type there can be only two values- True or False. This also can be given in multiple formats
like Yes/No, True/False, On/Off.

• Binary – The Binary data type used to store digitized images and sounds that comes as long string of zeros and ones.
It is possible to store photos of the products or employees, or sound snippets or voice messages in Base database.

Starting with LibreOffice Base

Follow the following steps to create the database.

Step 1. Start the LibreOffice Base as per the standard process of starting the application in Windows or Linux. In
Windows, click Start > LibreOffice or double click on the LibreOffice icon on the desktop or Select Base Database
option from the bottom left panel. In Ubuntu Linux, click on the Base icon located on the left panel. Or click on the
Show Applications as to search for its icon. Type Base in the search box. The LibreOffice Base application icon will be
displayed. Click on the Base icon to open the Base application.

Step 2. A Database Wizard opens It allows you to create a new database or open an existing database.

Tip: To open LibreOffice Base, you may search the application Base on your computer and click on the LibreOffice Base
icon.

Step 3. Since we want to create a new database, so click Create a new database radio button. If any database that has
already been created is to be opened, then select Open an Existing Database option to select the database to be
opened. Thereafter click Next button.

Step 4. The Next step gives the option to register our database with LibreOffice.org. If we register the database, then
our database is made public and hence can be accessed by other people. As of now, we would not like to register, so
we click and select the radio button with option, ‘No, do not register the database’.

Step 5. This step also asks whether you want to open the database for editing or want to create a table using the
wizard. The option Open the database for editing is already selected.

Step 6. Click Finish button to complete the database creation process. The Save As dialog box appears.

Step 7. Browse for the drive and folder where you want to store your database. Step 8. Type the name in the File
name text box. Step 9. Click Save button. The database in Base is saved with an extension .odb.
User Interface of Libre Office Base

Once a database is created, the screen appears. This is the User Interface of Open Office Base. The various components
of the Base User Interface are:

• Title Bar – The title bar displays the name of a database and an application in which it is made. The windows buttons
to maximize, minimize or close the window are located on the right corner of the title bar.

• Menu Bar – The menu bar appears below the title bar. It consists of seven menu items – File, Edit, View, Insert,
Tools, Window and Help. All these menu items contain commands that help to perform various operations on the
database.

• Standard Toolbar – It is located below the menu bar. It is used to access frequently used tools.

• Status Bar – It is located at the bottom of the interface window. It displays information about the type of view of the
object in the database. Database Pane – The database pane is located on the left side of the window. LibreOffice Base
is the collection of related data objects known as Tables, Forms, Queries, Reports and application modules. Depending
on the object that is selected, the respective Task Pane and Object Area displaying the created object appears.

Opening a Database

To open an already created database, click File > Open. The Open dialog box appears . Browse for the folder where
the database to be opened is stored. Select the desired database and click on Open button. Tip: Use the keyboard
shortcut key Ctrl+O to open an already existing database.

Creating a Table

Once the database is created, we can start working with objects of the database. First and foremost is the creation of
the table and then entering data in the table. A table in LibreOffice Base can be created using a wizard or using the
Design view.

Creating a Table using a Wizard

A table can be created at the time of creating a database or after creating database. To create a table
Editing Data

To edit or modify the previously entered data simply place the cursor on the field value that has to be edited to edit
and enter the new value. The Edit icon ( ) appears before the record that is being edited. This icon is displayed till the
table is saved after making the required changes. Press Esc key to cancel the corrections made and restore the original
contents.

Deleting Records from Table

To delete any record from the table, open the table and select the record to be deleted. The record can be deleted by
pressing the Del key from the keyboard or selecting the Delete Record option from the Edit menu. Alternatively a
record can also be deleted by right clicking on the record and clicking on the Delete Rows option from the pop up
menu. Attempting to delete the record will display the Confirmation box, Clicking on Yes button will finally delete the
record, while clicking on the No button will not delete the record.

Sorting Data in the Table

Data in a table can be arranged in ascending or descending order. This process of arranging the records in particular
order on any filed is called as sorting.

Follow the following steps to sort the table.

Step 1. Open the Event table in datasheet view and select the field on which you want to sort.

Step 2. From the tool bar click Sort Ascending icon if the table has to be sorted in ascending order of selected field.
Alternatively select Sort Descending icon if the table has to be sorted in descending order of selected field.

Step 3. The table will be sorted in the ascending order of points, Sometimes we may need to sort the table based on
more than one fields. In such case, click Sort icon on the toolbar. The Sort Order dialog will be displayed. Select the
appropriate field name and field value according to which the records are to be sorted. Choose the order of sorting
ascending or descending as required. from the Order drop down box. Multiple fields may be selected in this dialog box.
Click OK button once done.

Closing LibreOffice Base

To close the application window of LibreOffice Base, click on the File > Close or click on the cross (x) button of the
LibreOffice Base window.

Chapter 3: Working with Multiple Tables

Editing and Deleting Tables

It is possible to copy, rename, edit and delete the table of database by right clicking on the table name and using the
appropriate option from the pop up menu. 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. Do the required modifications and save the table. Also note
that the changes made will not affect the previous records entered in the table.

Similarly 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.

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.

Relationships between Tables

While working with multiple tables, you need to check the redundancy and inconsistency of data. The record for a
particular entity should neither be repeated nor different data values should appear for a single entity in the database.
This is done by setting relationship between the tables of a database. The most important prerequisite for setting a
relationship is that there must be a common field(s) between the two tables to create a relationship.

In table1 (Student_Details), Admission No is the primary key. In table 2 (Student_ Result), Roll No is the primary key
and Admission No is the foreign key. So each record in Table 10.2 has a value of Admission No that corresponds to a
record in Table with same value of Admission No. It is important to note that the data types of the common field in
both the tables must be same. If they are not same then LibreOffice Base will display an error message and will not
allow to set the relationship between the two tables. Once the relationship between the two tables has been set, the
integrity of data will be managed by the DBMS. That means once a student’s record has been entered in the
Student_Details table, only then that particular Admission No can be entered in the Student_ Result table. The record
pertaining to Admission No in Student_Details table is considered as the master record while the corresponding record
in the related table (Student_Result) is the transaction record. Therefore Student_Details is called the master table
and Student_Result is called the transaction table.
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.

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 example, 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 may 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 example, a teacher in a school may hold multiple responsibilities such as class teacher, an activity incharge 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. Similarly a shopkeeper may sell multiple products to multiple
customers. So many-to-many relationship exists between a product and a customer. The corresponding records in
master table and transaction table are in same color.

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.

Creating Relationships between Tables

There are two tables in the database – Events and EventCategory with a common field as CategoryID.

In Event table, EventID is the primary key and CategoryID is the foreign key.

In EventCategory table, CategoryID is the primary key. To set up relationship between these tables follow the following
steps.

Step 1. From main menu of LibreOffice Base, click on Tools > Relationships…

Step 2. The Relationship Design screen.

In the middle of the screen there is Add Tables dialog box. Both the tables are listed in the dialog box.

Step 3. In the Add Tables dialog box, click Events table and then click Add button. Similarly add EventCategory table to
the Relationship Area.
Step 4. Click Close button to close the Add Tables dialog box. Observe that the tables Events and EventCategory table
added to the Relationship Area along with all its field list.

Step 5. As discussed before, CategoryID is the common field in the two tables. Hence it will be used to set a relationship
between the two tables. To create a relation Add Tables dialog box in Relationship Design Screen, Events and
EventCategory Tables added in Relationship Design window. Relationship between two tables between the two tables,
we just have to drag the common field CategoryID from the Events table and drop it in EventCategory table. A line
connecting both the tables with the common field (CategoryID) appears on the screen. The line is labeled as ‘l’ on the
primary key side and as ‘n’ on the foreign key side. Hence the CatgeoryID from EventCategory table as primary key will
have unique values and is called referenced field. On the other hand, in the Events table, the values of CategoryID
might be repeated. Here it is known as referencing field. the CategoryID of the Events table is referenced field and
CategoryID of the EventCategory table is referencing field. This type of relationship where one value of a table is
associated with multiple values in another table is a One-to-many relationship. In this relationship EventsCategory is
the master table. So the master record with a particular CategoryID has to be added in EventsCategory table first. Only
then the corresponding record can be added in the Events table. Also, only one record with a specific CategoryID will
exist in the master table but multiple values of CategoryID might exist in the transaction table, thereby forming a one-
to-many relationship.

Referential Integrity

According to the principle of referential integrity, no unmatched foreign key values should exist in the database. That
means if a record, say Admission No as 1001 is not present or deleted in the master table (Student_Details) of Student
database, then there should be no record with Admission no as 1001 in the transaction table (Student_Result) as well.

Similarly, in Ruhi’s Sports Day database, if a particular category of sports, say C003 is deleted from the master table
EventCategory, then there should be no record with Category as C003 in the transaction table. Likewise, if any student
leaves the school and his record is deleted from Student_Details table, then there is no question of his appearing for
exams and having a result.

Hence corresponding record in the transaction table (Student_Result) should either have NULL value or should be
deleted. In Ruhi’s Sports Day database as well, the CategoryID that exists in EventCategory table can only be entered
in Events table. As mentioned before, once the relationship between the two tables has been set, the integrity of data
will be managed by the DBMS. LibreOffice Base will allow only that corresponding record to be entered in the
transaction table which already exists in the master table. 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.

To set the relationship properties double click on the relation line joining the two tables, Events and EventCategory. A
Relations dialog box will open. By default the radio button with No action option will be selected. Choose any of the
desired option and click OK to set the referential integrity between the two tables.

Chapter 3 : Queries in Base

Introduction

A database is used to store data in an organized manner so as to retrieve it easily and accurately from database. To
search for the desired record and to retrieve the desired data, we have to give its specifications to DBMS. Such
specifications are given to the database in the form of queries. For example, we may have to specify the fields that we
want to display or any particular data value based on which the records are to be filtered from the table(s). Therefore,
we can say that a query is a sort of question asked from a database. Depending upon specifications given in the query,
the specific records are searched from the table(s) in the database and then displayed in the desired manner. Such
information may be difficult to find by just looking at a single table or multiple tables. In fact as the number of records
increase, finding the desired information becomes more and more difficult. By using queries, we are able to retrieve
data without going individually through each record in the table(s) and also display them in desired format.

Queries

A query is one of the most important feature of any DBMS. Using a query, we can retrieve and display data from one
or more tables in a database. This is done by giving specific search criteria to the DBMS so that we are able to view the
exact information that we want. LibreOffice Base allows us to create a query and even save it as an object in a database.
This helps us to run the query multiple times as and when required. Using a query, we can specify the fields that we
want to display and also the criterion based on which the records to be filtered. The information may be retrieved
from a single table or from multiple tables. Also the result of the query is displayed in tabular form with field names in
columns and the records in rows.
It includes the following:

• Name of the Query – By default, the name of the query is Query_Events by default. If desired, type the new name in
the text box.

• The action to be performed after the wizard finishes – By default Display Query option will be selected. Click and
select the Modify Query radio button if the query has to be edited in the Design view.
• Complete detail of the query – This section contains a summary about the query that has been created.

Step 11. Click on Finish button. The records with CategoryID as C001 will be displayed on the screen. Observe the
column headings. Are all of them same as the field names in the Events table? Once the query is created, it can be
edited in Design view.

Creating a Query in Design View

Another way to create a query is using the Design view. This is a more flexible method to create a query from either
single or a multiple tables of a database. Let us create a query to display records of Athletics category. For this query,
records have to be filtered from both Events and EventCategory tables. Open Sports Day database and follow the
following steps to create a query in Design View:

Step 1. Click Queries icon on the Objects Pane in the Database Window.

Step 2. Click Create Query in Design View… icon in the Tasks Pane. The Query Design Window appears. In the middle
of the window the Add Table or Query dialog box.

Step 3. Click on the Event table to be used in the query and then click on Add Create Query in Design View button.
Alternatively double click on the Events table. The table will be added to the Tables Pane present at the top of the
Query Design window.

Step 4. Similarly add EventCategory table to Tables Pane of the Query Design window.

Step 5 . Click Close button in the Add Table or Query dialog box to close it. The tables Events and EventCategory added
will be displayed in the Table pane.

Step 6. Next step is to select the fields. For our query we want to display Event Name and Winner from the Events table
and Category Name from the EventCategory table. So in the list box of Events table, double click on EventName and
Winner field. Similarly add the field CategoryName form EventCategory table. The field name along with the table
name is displayed in the Design grid present in the lower half of the Query Design window.

Step 7. In the grid, there is a row titled Alias. As mentioned before, it can be used to display meaningful names in the
output. For example, instead of Winner, we would just like to display Winner Name. For this, type Winner Name in the
Alias text box under Winner column.

Step 8. By default, the data that is displayed as a result of the query is not sorted. To sort the records in either ascending
or descending order of a particular field, the Sort row is given in the grid. For example, to display the records in
alphabetical order of Event Name, select Ascending from the drop down list box visible in the Sort row under Event
Name column.

Step 9. Once the query is designed, click Run Query ( ) button on the toolbar or press F5 key. The query result will be
displayed in the Tables Pane area as shown.

Step 10. Click on Save button to save the query. The Save As dialog box will be displayed.

Step 11. By default, the Query Name as Query1 will be displayed. Type a different name if required. Click on OK button
to save the query.

The name of the query will be seen in the Objects area in the Database window. To run the query again and see the
result s of the query, double click on the query name. The results of the query will be displayed in a separate window.
To close the Query window, click on close button on the top right corner of the window.

Editing a Query

To edit any query, click on the Query icon of the query that has to be edited. The list of queries that have been created
will be displayed in the Objects Area. Right click on the Query Name in the Objects Area of the Database window.

Select Edit option from the drop down menu. The Query Design window will be displayed.
Chapter 4: Forms and Reports

Introduction

We know that tables in a database are used to store data in an organized manner. For this we have to enter data into
the tables. Datasheet view is used to enter data into the tables. The row and column format of the data-sheet view is
not a user friendly interface. So it is required to develop a user friendly data entry screen for data entry operator or a
user, who is not very well versed with computers. Moreover, while doing data entry, the user may accidentally or
intentionally alter the data in the table.

Therefore LibreOffice Base provides the Form feature for data entry purposes. Also, when the user wants to retrieve
and view the data from one or more tables in a database using queries, it is again displayed in data-sheet view. The
Report feature of OpenOffice Base helps to present the retrieved data in a user friendly, understandable and formatted
manner.

Both reports and forms are considered as objects of the database and are present in the Database Pane of the
LibreOffice Base User Interface.

Forms

A form is an object of the database that has a user-friendly interface where data can be entered and seen in an
attractive and easy-to-read format. For any database, it is the front end for data entry and data modification. It displays
the data in a layout design by us and not just in a simple row and column format.

Primarily, a form contains field controls arranged in a presentable and user-friendly manner. Each field control consists
of a label and the field value text box. A label is a piece of text that specifies the data that should be entered in the
field value text box. A field value text box is linked to the respective field in the table. We may add all or selected fields
from the table on the form. In addition to field controls, it may contain some additional text like titles, headings and
names, graphics like logos, list boxes and radio buttons.

There are two ways to create a form:

• Using a wizard • Using the Design View

Reports

A report is another useful feature of a database management system. We have seen that the records that have been
extracted using a query are displayed in a simple row and column format. Instead, using a report we can present the
retrieved data in an attractive and customized manner. We can create a report based on a table or a query or both.
Preferably, if a report has to be generated from multiple tables, a query should be created first and then that query
can be used to generate the report.

You might also like