0% found this document useful (0 votes)
13 views55 pages

Introduction to Database Management Systems

Chapter 8 introduces Database Management Systems (DBMS), explaining the organization of data and the importance of databases in managing information. It covers the advantages of databases, types of data models, and key concepts such as entities, tables, and keys. Chapter 9 focuses on using LibreOffice Base as a free DBMS, detailing data types, field properties, and basic operations like creating tables and entering data.
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)
13 views55 pages

Introduction to Database Management Systems

Chapter 8 introduces Database Management Systems (DBMS), explaining the organization of data and the importance of databases in managing information. It covers the advantages of databases, types of data models, and key concepts such as entities, tables, and keys. Chapter 9 focuses on using LibreOffice Base as a free DBMS, detailing data types, field properties, and basic operations like creating tables and entering data.
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

Chapter 8 Introduction to DBMS

INTRODUCTION
A database is an organized collection of data. It is considered as a
container of information.

In the manual system, you would maintain several files with different bits of
information while in the computerized system you would use database
programs such as Microsoft Access, LibreOffice Base, [Link]
Base, and MySQL, to organize the data as per your business need.

Data and Information


The raw facts and figures is called data. The facts may be related to any
person, place, activity or things. The examples of data are marks scored by
the students, numbers of items sold, employee names, product names,
addresses, tax codes, registration etc.

Information is the processed or organized form of data. If data is not


correct, 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.

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. for example the phone book can
be considered a simple database which contains Name and Mobile number
in an orderly manner

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 common examples
of DBMS are MS Access, Open Office or LibreOffice base, Oracle, MySQL.

Advantages of Database
1) Organised Storage : The data in the database is stored in an organised
manner, so that retrieval of the required data is fast and accurate.

2) Data Analysis : A database helps in analysis of data based on certain


criteria.

3) Reduces Data Redundancy : Database reduces data redundancy


(duplication of data)

4) Sharing of Data : In a database, the users of the database can share the
data among themselves.

5) Data Integrity : Data integrity means that the data is accurate and
consistent in the database.

6) Data Security : Database provides data security as only authorized users


are allowed to access the database and their identity are authenticated by
using a username and password.

7) Privacy : The privacy rule in a database states that only the authorized
users can access a database according to its privacy constraints.

8) Backup and Recovery : Database Management System automatically


takes care of backup and recovery.
Data Models
A structure of database that describes the manner in which data will be
stored and retrieved is known as data model.

A data model consists of components for describing the data, relationships


among them and the constraints​
that hold data.

Types of Data Models


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. All these records are linked to each other at
various levels, thereby forming a hierarchy. For example

Introduction to
DBMS – Hierarchical Data Model

2. Network Data Model


This model is used to represent the many-to-many relationship among the
database constraints. In other words we can say that in this model, multiple
records are linked to same master file.

Introduction to
DBMS – Network Data Model

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


data elements are stored in different tables and 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


Entity: It is a real world object about which information is to be stored in a
database. Each entity is a collection of attributes associated with it. for
example 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.

Field or Columns or attributes : A field is the smallest entity in the


database. Fields are presented as columns within a table. 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.

Record or Row or Tuple – 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.

Primary Key : A primary key or simply a key is a field that uniquely


identifies each and every record in a table.

Foreign key : The foreign key identifies a column or set of columns in one
(referencing) table that refers to a column or set of columns in another
(referenced) table.

Primary Key vs Foreign Key

NOTE : In Student Registration Table, ‘Enrolment_Number’ is the primary


key and in the Student Marks Table, ‘Roll_Number’ is the primary key,
whereas ‘Enrollment_Number’ is the foreign key.
Composite Primary Key : When primary key constraint is applied on one or
more columns then it is known as Composite Primary Key.

Relational Database : A relational database is a collection of related tables.

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.

NOTE: A collection of fields make a record, a collection of records make a


table and a collection of tables make a database

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
given below

Table : – A table is the basic unit of any DBMS. The data is first stored in
tables in row and column format.

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. 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 : – A report is the formatted result of queries which contains data


required for decision-making and analysis.

Ch 9 Starting with LibreOffice Base

Introduction
LibreOffice Base is a free and open source DBMS. It can be downloaded
from [Link]. Data which we stored in DBMS 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.

Data Types
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 :

1. 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. Various types of Text data
types are:

Na Data type Description


me

Me LONGVA It is used to store some descriptive data having more


mo RCHAR than 255

characters. It can store text data up to 64,000


characters.
Tex CHAR It is used to enter fixed number of characters specified
t by the user.
(fix)

It can be used for license number, passport number as


they have

fixed number of characters.

Tex VARCHA It Stores upto the specified length. The number of


t R bytes consumed depends on the number of characters
entered by the user. For example, the address is
defined as varchar (50), and if the address entered by
the user is of 20 characters then only 20 bytes will be
occupied in the database.

2. 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. Following table shows different numeric data types

Name Data Type Range

Tiny Integer TYNYINT 0-255


Small Integer SMALLINT -32768 to 32768

Integer INTEGER -2.14×109 to 2.14×109

BigInt BIGINT -2.3×1018 to 2.3×1018

Number NUMERIC Unlimited

Decimal DECIMAL Unlimited

Float FLOAT

Real REAL 5×10(-324) to 1.79×10(308)

Double DOUBLE

3. Currency Data Type –

The currency data type is used to store the numeric values with symbol of
currencies of various countries. For example $100, £ 500 or Rs. 25.50.
4. Date Data Type –

This data type is used to store dates and time. For example 12/25/2019,
08:45 AM. Following table shows various forms of date data type.

Name Description

Date Stores the year, month and day as it is stored in the


system.

Time Stores the time of the day as hour, minute and second.

Timestamp Stores date and time information at once

5. Boolean Data Type –

In boolean data type there can be only two values- True or False, Yes or No

6. Binary Data Type –

The Binary data type used to store digitized images and sounds that comes
as long string of zeros and ones.

Field Properties :
To set the field properties: Select the table > Right click > Select the option
Edit > the table will open in Design View.
In design view there are different properties of fields according to the data
type set for each field.

The properties of numeric type data is given below :

1) AutoValue – if set to yes then field will get the auto numeric values.

2) AutoValue – if set to yes then field will get the auto numeric values.

3) Length – By default length of the field is 10 but the size of the field can
be set to maximum length.

4) Default Value – A default value can be set for a field if user don’t provide
any value while entering the values in the table.

5) Format – This property helps to set the format of the data entered in the
field such as 91-222-333.

The properties of character type data is shown below :

1) Entry Required – if set to yes then it will be must to insert the value in the
field.

2) Length – By default length of the field is 10 but the size of the field can
be set to maximum length.

3) Default Value – A default value can be set for a field if user don’t provide
any value while entering the values in the table.

4) Format – This property helps to set the format of the data entered in the
field such as 91-222-333.

Starting with LibreOffice Base


1. In Windows, click Start > LibreOffice or double click on the LibreOffice
icon on the desktop.

2. A Database Wizard opens as shown below

Database
Wizard

3. We want to create a new database, so click Create a new database radio


button and click Next button

NOTE: If any database that has already been created is to be opened, then
select Open an Existing Database
4. The Next step gives the option to register our database with
[Link]. Click and select the radio button with option, ‘No, do not
register the database’.

Register
Database

NOTE: If we register the database, then our database is made public and
hence can be accessed by other people.

5. This step also asks whether you want to open the database for editing or
want to create a table using the wizard.
6. Click Finish button. The Save As dialog box appears.

7. Select the location and type the name in the File name text box and click
on Save button.

NOTE: The database in Base is saved with an extension .odb. The default
name of database is New [Link].

User Interface of Libre 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.

Menu Bar – The menu bar appears below the title bar. It consists of seven
menu items – File, Edit, View, Insert, Tools, Window and Help.

Standard Toolbar – It is located below the menu bar.

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. It shows data objects like Tables,​
Forms, Queries, Reports​
Ch 9 Starting with Libre Office Base NOTES

Creating a Table using a Wizard


1. Select “Use Wizard to create a table” option from the Tasks Pane. The
Table Wizard dialog box will open.

2. The Table Wizard of Base consists of ready-made tables. Select any one
table, say Customer.

3. After selecting the Customer table, The required fields from Available
fields box can be shifted one by one to Selected fields box using > button
or in one stroke by clicking on >> button.

4. Click on Next button and set types and formats.

5. Click on Next button and set Primary key.

6. Click on Next button, that will take you to the complete the process of
creating table using wizard and finally click on Finish button.
Setting the Primary Key
To make a particular field as the primary key, place the mouse pointer
before the field name, and right click. A pop up menu appears and Select
the Primary Key option. A key icon appears before the field name indicating
that it is a primary key.

Starting with LibreOffice Base

Saving a Table
1. To save the table click on the save button or click File > Save As or press
Ctrl + S from the keyboard.

2. A Save As dialog box is displayed. Enter the name of table and click on
OK button.

Entering Data in a Table


To enter data in the table, double click on the created table icon in the
Tables Object Area on the database screen. Alternatively, we can open the
table by right clicking on the desired table and then selecting the Open
option from the drop down menu. The datasheet view of the table will
appear. In this view, we can enter the records

Navigating through the Table


To navigate through various records of the table, we use the navigation box
present at the bottom of the datasheet window as shown below.

Record Navigation
The various components of Navigation Box are as follows:

Record Selector Box – This is the text box where the currently active
record number is displayed. We may enter the record number that we want
to see in this text box.


Navigation Buttons – These are used to scroll vertically in the table.

●​ Press |◄ button to move to the first record.


●​ Press ► and ◄ to move to the next and previous records
respectively.
●​ Press ►| button to move to the last record.

Editing Data
To edit or modify the entered data, 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.

NOTE: Press Esc key to cancel the corrections made and restore the
original contents.

Deleting Records from Table


Open the table and select the record to be deleted. Now press del key from
the keyboard or selecting the Delete Record option from the Edit menu or
right clicking on the record and clicking on the Delete Rows option from
the pop up menu.

NOTE: 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. Steps to sort the table are:

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

2. From the tool bar click Sort Ascending or Sort Descending icon to sort in
ascending or descending order respectively.

NOTE: To sort the table based on more than one fields. In such case, click
Sort icon on the toolbar.

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.

Ch 10 Working with Multiple Tables

INTRODUCTION
After creating the table in database, we may require to edit or delete the
table. Sometimes we have to setup the relations between tables to control
data redundancy and inconsistency.

If you set up relations between tables, then adding or updating a record in


one table reflect the changes in all the related tables.

Editing and Deleting Tables


We can 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

1.​ Adding a new field.


2.​ Deleting any field in a table
3.​ Modify or Alter any of the field properties.

Steps to edit a table are:

1.​ Open the Database User Interface window.


2.​ Select the Table object in Database Pane.
3.​ Right click on the table name and select Edit option from the
pop menu.
4.​ The design view window of the table will be displayed.
5.​ Do the required modifications and save the table.

Working with Multiple Tables NOTES

Steps to Delete a table are:


1.​ Open the Database User Interface window.
2.​ Select the Table object in Database Pane.
3.​ Right click on the table name and select Delete option from the
pop menu.
4.​ A confirmation box to confirm for deletion of the table will be
displayed.
5.​ Click on Yes button to finally delete the table.

Steps to Rename a table are:

1.​ right click on the table name in the Table Area.


2.​ Select Rename.. option from the pop up menu.
3.​ A cursor will appear.
4.​ Type the new name and press the Enter key.

Relationships between Tables


While working with multiple tables, we should check the redundancy and
inconsistency of data. This can be done by setting relationship between the
tables of a database.

Let us consider an example of a database containing following two


tables–Student_Details and Student_Result
Relationship – Working with Multiple Tables

In Table 10.1 (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.

Each record in Table 10.2 has a value of Admission No. that corresponds to
a record in Table 10.1 with same​
value of Admission No.

NOTE: 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.

After setting the relationship between two tables, 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. Therefore
Student_Details is called the master table and Student_Result is called the
transaction table.

Types of Relationships
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-One
Relationship

One-to-Many relationship: 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-to-Many Relationship

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.

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.
Many-to-Many Relationship

Advantages of Relating Tables in a


Database
1.​ A relationship can help prevent data redundancy.
2.​ It helps prevent missing data by keeping deleted data from
getting out of synch. This is called referential integrity.
3.​ Creating relationships between tables restricts the user from
entering invalid data in the referenced fields.
4.​ Any updation in the master table is automatically reflected in the
transaction tables.

Creating Relationships between Tables


●​ Click on Tools > Relationships…
●​ The Relationship Design screen will appear.
●​ In the middle of the screen there is Add Tables dialog box (as
shown below).

●​ Select the table and click on Add table button.


●​ Close the Add Tables dialog box.
●​ Drag the common field from one table and drop it in another
table.
●​ A line connecting both the tables with the common field appears
on the screen (as shown below).
NOTE: When One value of a table is associated with multiple values in
another table is called One-to-many relationship.

Remove the Relationships

The relationships applied on the tables can be removed also with the help
of Delete option. Right Click on the relationship thread and select Delete
option.

Referential Integrity
Referential integrity is used to maintain accuracy and consistency of data
in a relationship. In Base, data can be linked between two or more tables
with the help of primary key and foreign key.

According to the principle of referential integrity if a record say Admission


No as 1001 is not present or deleted in the master table, then there should
be no record with same Admission no as 1001 in the transaction table.

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.

Referential integrity helps to avoid:

1) Adding records to a related table if there is no associated record


available in the primary key table.

2) Changing values in a primary if any dependent records are present in


associated table(s).

3) Deleting records from a primary key table if there are any matching
related records available in associated table(s).

Ch 11 Queries in Libre Office Base

Introduction
A database is used to store data in an organized manner. Queries are used
to retrieve the desired data easily and accurately from database. In other
words we can say that a query is a sort of question asked from a database.

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.
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. For example In a
Student database, if we want to display the names and marks of the
students in a particular class from the Result table, who have scored less
than 320 aggregate marks.

Queries
A query is to collect specific information from the pool of data. A query
helps us to join information from different tables and filter that information

OR

Queries are commands that are used to define the data structure and also
to manipulate the data in the database.

Creating a Query
A query can be created in three ways. In this chapter we will learn the first
two methods to create a query.

1.​ Using a Wizard


2.​ In Design View
3.​ In SQL view

Creating a Query Using a Wizard


Consider the following table: Table1 (created in database: School)
Rno Name Class Fees

1 Anil X 2500

2 Anuj XI 3000

3 Ashish XII 3200

Let us create a query that will display Roll number, Name, Class from table
“Table1” whose Roll number is 3.

To create a query using a wizard, follow the following steps.

1. Open the School database. Click on Queries button present in the


Database Pane.

2. In the Tasks Area, click on Use Wizard to Create Query… option

3. The Query Wizard will open.


Query Wizard

4. Select the required table and then select the required fields(Name, Class
and Rno) from the “Available fields” window to “Field in the Query” window
and click on Next Button.
Query Wizard Field Selection

NOTE: Clicking on >> button moves all fields to “Fields in the Query” area.

6. Select the ascending or descending order of any particular field of the


table. Since we do not want to set in a particular order, so we click on Next
button.

7. The next step is to set the search conditions or the criteria on the basis
of which records will be filtered from the table.
Query wizard criteria

NOTE: Since we want to display the detail of student having roll number 3
so we set roll number as 3 in above step

9. Steps 4, 5 and 6 given in the Steps Pane are not required if there is no
numeric field involved in the query. So skip these steps.

10. The next step to give alias name i.e. the column header name will be
displayed when we run the query. Click on Next after writing alias name.
Query Wizard Alias

NOTE: By default the field names will be displayed as column headers.


Some times field names are not user friendly, so an alias name which is
more readable is required. For example change the default field name Rno
to Roll Number.

11. The last step of the Query wizard displays the entire overview of the
query.
Libre Office Base Query Wizard Overview

12. Click on Finish button.

NOTE:

1.​ Once the query is created, it can be edited in Design view.

NOTE: Last Step of Query Wizard includes the following (Query Wizard
Overview).

Name of the Query – By default, the name of the query is Query_Table1.


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.

Creating a Query in Design View


Another way to create a query is using the Design view. This is a more
flexible method.

Consider the following table: Table1 (created in database: School)

Rno Name Class Fees

1 Anil X 2500

2 Anuj XI 3000

3 Ashish XII 3200

Let us create a query that will display Roll number, Name, Class from table
“Table1” whose Roll number is 3

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


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 is displayed as shown below

Query
Design View
3. Click on the “Table1” table to be used in the query and then click on Add
Button. Alternatively double click on the “Table1” table.

4. Click Close button in the Add Table or Query dialog box to close it.

5. Next step is to select the fields. For our query we want to display Roll
number, Name and Class. So in the list box of “Table1” table, double click
on the required field.

NOTE: Observe that the Visible Check Box is by default selected. This
means that all these three fields will be visible when you run the query. In
the grid, there is a row titled Alias. It can be used to display meaningful
names in the output. For example, instead of Rno, we would just like to
display Roll Number.

To sort the records in either ascending or descending order of a particular


field, the Sort row is given in​
the grid. Select ascending or descending from the drop down of Sort row.

6. Write 3 in Criteria row below the Roll number Column.


Query Design-View

NOTE: 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.

7. Click on Save button to save the query.

NOTE: By default, the name of the Query is Query1. To run the query again,
double click on the query name. To close the Query window, click on on
close button on the top right corner of the window.
Editing a Query
1. Right click on the Query Name Which you want to edit in the Objects
Area of the Database window.

2. Select Edit option from the drop down menu. The Query Design window
will be displayed.

3. Make the required changes like change the Alias, apply criteria or edit
the existing criteria etc.

4. Click on Save and close the Query window.

Working with Numerical Data


Consider the following table: Table1 (created in database: School)

Rno Name Class Fees

1 Anil X 2500

2 Anuj XI 3000

3 Ashish XII 3200

Let us create a query that will display maximum fees from the table
“Table1”.
1. In the Database Window, click Create Query in Design View… button to
open the Query Design Window.

2. Select the required field. For our query we want to display Fees. So in the
list box of “Table1” table, double click on the required field.

3. Select the function “Maximum” from the drop down list of functions
under “Fees” Column as shown below.

Design Query using Function

4. Press F5 to run the query.




Ch 12 Forms and Reports

Introduction
Data-sheet view is used to enter data into the tables which 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.

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 then Report feature of LibreOffice Base
helps us 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. For any database, it is the front end for data entry and
data modification.

A form contains field controls arranged in a presentable 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.
A form 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

Creating a Form Using a Wizard


To create a form using wizard, follow the following steps:

1. Click the Form icon on the Database Pane. Click the option Use Wizard to
Create Form… on the Tasks Pane.

Forms Wizard
2. Select the table for which the form has to be created.

3. After selecting the “Table1” table, all the fields of the “Table1” table will
be listed in the Available Fields list box as shown below.

Form Wizard

4. Shift all the fields of Event table from Available Fields list box to Fields in
the Form list box using >> button. (shown above)

5. The second step consists of setting up a subform, i.e. a form within a


form. Since we do not want to set up any subform, click Next button.

6. This step arrange controls i.e. to set up the design of the form. In this
step we arrange the label and field value text boxes as we want them to be
visible on the screen.
NOTE: By default, all controls will be left aligned. A field control consists of
two parts – label and the field value text box.

7. Click Next button

8. The step 6 of the wizard asks whether the form will be used for
displaying data, entering data or both. After Selecting appropriate option,
we click on Next button.

9. The next step is to apply styles to the form. Select the desired
background colour and border type.

NOTE: By default the border of the field text value is displayed in 3D look.
We can select the options No Border or Flat if required.

Form Wizard
10. Click Next button.

11. The next step is to set the name of the form.

12. Click Finish button. The form with the first record will be displayed on
the screen in a separate window.

NOTE:

1.​ By default the name of the form is same as the name of the
table.
2.​ By default, the radio button with the option Work with the form
is selected. If you wish to modify the form after the wizard
finishes, click Modify the form option.

Forms Layout
Four layouts of Forms are given in the Wizard.

Form Layout

1. Columnar display with Labels on the left of the field value.

2. Columnar display with Labels on top of the field value.

3. Display as datasheet.

4. Block display with labels on top.

Form Design Window


Form Design window has two toolbars. On the left of the Form Design
window is the Forms Control toolbar and at the bottom is the Records
toolbar.

Form Design
Window

1. Forms Control Toolbar

This toolbar contains various controls that can be added to the form.

2. Records Toolbar
The Records toolbar contains the navigation control buttons. With the help
of these we can move from one record to another record.

Modifying a Form
We can modify the form in any manner once it is created. The modification
includes change the background color, font size and color of the text or
even positioning of various controls in the form.

Changing the background color

Steps to change the background color of the form are:

1. Open OpenOffice Base and click on Forms icon in the Database Pane.

2. Right click on the form name and select Edit… option. A separate Form
Design View will open.

3. To change the background color of the form, right click on the form and
select Page Style… option from the pop up menu.

4. The Page Style dialog box will appear, where you select Area tab and
choose the desired color from the palette.
Form background colour

5. Click on OK button. The selected color will be applied on the form.

Editing the labels

Edit the labels means to change the text or to change the formatting
effects. Steps to edit the labels are given below.

1. Place the mouse pointer over the label which you want to edit.

2. Press the keyboard shortcut key Ctrl+Click to select the label.


3. Right click on the selected label and select Control Properties… option
from the pop up menu.

4. The Properties: Label Field dialog box will appear. (It contains various
properties of the selected label like width, height, alignment, font style and
font size)

Properties: Label Field Dialog Box

5. After making the desired changes close the Properties dialog box.

Moving a Control

Click on the control (either Label or Text box) that has to be moved. Both
the label and the text box will be selected. Now, click and drag the control
to move to the desired location.

NOTE: If only Label or Text box to be moved then press Ctrl key while
clicking on that control.
Changing the size of the textbox control

Steps to change the size of the textbox control are:

1.​ Select the textbox and handles will appear around it.
2.​ Place the mouse pointer on any of these handles and drag them
to the desired size.

Adding a Tool tip

A tool-tip is a small piece of text that is displayed when the mouse pointer
is placed on a particular control. In other words we can say text that
appears when the mouse pointer is placed on a particular control is called
the tool-tip text or help text. Steps to add tool tip are given below:

1.​ Press Ctrl button and click on a text box where you want to add
a tool tip.
2.​ Right click and select Control Properties… option. The
Properties: Text Box dialog box will be displayed.
3.​ Type the required text in Help text property.
4.​ Close the dialog box.

Forms Controls Toolbar


The forms control toolbar contains various tools to add or edit controls on
the form. Let us learn to use few of these tools.

Adding a calendar for the date field

Steps to add the calendar to the date field in the form are:

1.​ Select the textbox where you want to add calendar.


2.​ Right click and select Control Properties…. option.
3.​ In the Properties: Date Field dialog box, scroll down for Date
Format property.
4.​ Click to open the list box and select Standard (long) format.
5.​ Scroll down to find DropDown property. (By default its value will
be No) and Select Yes
6.​ Close the dialog box.

NOTE: By default, Standard (short) format will be displayed.

Adding text to the form.

Sometimes, we may need to enter titles, headings or subheadings in a


form. These are called Labels. Steps to insert the title text in the form are:

1.​ Click the Label tool on the Form Controls tool box.
2.​ Click and drag the mouse to create a label field box on the form.
3.​ Double click on box to open the Properties: Label Field dialog
box.
4.​ Type the title in the Label property.
5.​ Set the Font by clicking the Font button in front of the Font
property. (The Character dialog box will be displayed and
choose the desired font style and size and click on OK button)
6.​ Close the Properties: Label Field dialog box.

Adding a new record using a form.

After designing the form, we can insert records using the form. For this, we
have to shift from “Design View” to “Form View” by clicking on Design
Mode button on the Forms Controls toolbar. The Form View window
appears with the first record displayed in the respective text boxes.

Steps to add a new record into the table using the form are:

1.​ Click on New Record button on the Records toolbar.


2.​ A blank form with the cursor blinking in the first text box will be
displayed.
3.​ Enter the record and click on save record button.

Delete a record using a form.


To delete any record, navigate to the record by either typing the record
number in the Record text box or by using the navigation buttons.
Thereafter click Delete button on the Records toolbar.

NOTE: To toggle between Design view and Form view press Design Mode
button on the Forms Controls toolbar.

Reports
A report is another useful feature of a database management system. Using
a report we can present the data in an attractive and customized manner.
We can create a report based on a table or a query or both. 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.

Steps to create a report are:

1.​ Click on the Reports icon in the Database Pane.


2.​ Click Use Wizard to Create Report… option.
3.​ The Report wizard along with two other windows will be
displayed. (Report Builder window and the other is Add Field
dialog box)
4.​ Select the table and the corresponding fields that we want to
display in our report.
5.​ Click >> button to shift all the fields from Available Fields list
box to Fields in report list box.
6.​ Click on the Next button.
7.​ The next step is to label the fields. (Type the new names of the
fields in the respective text boxes if required)
8.​ Click on the Next button.
9.​ The next step is to group the data based on any of the fields in
the report.
10.​ The fourth step is to set the Sort options. (The radio button
for Ascending is already selected. Select Descending radio
button to display the records in descending order)
11.​Click on the Next button and select the layout of the report.
12.​ Click on the Next button and type the name of the report.
13.​ Click on Finish button to display the report.

NOTE (in reference to step 11 given above)

Layout is the manner in which the labels, field values and titles will be
displayed in the report. We may also choose the orientation option
Landscape or Portrait in this step.

Difference between Dynamic and Static Report

When the field values in the base table or query changes, the dynamic
report will also change automatically while static report will remain same,
whenever, there is a change in the values of the table.

Dynamic report is by default selected.

Inserting other controls in the report

The report generated is very simple and boring. We can make report more
presentable by inserting some more controls like titles, author name, date
of generation of report etc.

Right click on the Report name on the LibreOffice User Interface and then
select the Edit… option. The Report Builder window will open as shown
below. In this window, various controls can be inserted using the Report
Controls toolbar.
Report Builder Window

Inserting Titles and Headings

To insert the title of the report, follow the following steps.

1.​ Click on the Label tool available on the Report Controls toolbar.
2.​ Bring the mouse pointer on the report. Click and drag to insert
the label textbox.
3.​ Double click on it to open the Properties dialog box.
4.​ Type the title text that you want to display in the Label property
textbox and also set the font style and size using the Font
property.
5.​ Close the Properties dialog box.

Inserting Date and Time

Steps to insert the date on which the report is generated are given below:

1. Click in the Page Header area to make it active.

2. Click Insert > Date and Time… option

3. The Date and Time dialog box will be displayed. Select the desired format
for date and time format and click on OK button.
Date and Time Window

4. The date will be inserted on the top left corner of the Page Header area.
We can drag it to reposition it in any place in the Page Header area.

You might also like