Database Management System using LibreOffice Base
Definitions
1> Data: Raw facts and figures are known as 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.
2> Information: Processed or organized form of data is known as information.
3> Database: It is an organized collection of logically related data items, which can be manipulated and
retrieved in the desired manner by using suitable software.
4> DBMS (DataBase Management System): It is the software which is used to create databases,
manipulate data of databases and retrieve the desired data from databases.
5> Relational Database: It is a type of database in which data are stored in multiple inter-related tables.
6> RDBMS (Relational DataBase Management System): A software used to create and manage
relational databases and retrieve the desired data from relational databases.
7> Data Models: The structure of a database is known as Data Model. A data Model describes the way
in which data are stored, manipulated and retrieved. Components of data, relationship between the
data and the constraints applied on the data also within the domain of a data model.
Types of Data Models: There are several data models such as:
a> Relational Data Model: The relational model is a data model that represents data as a collection
of inter-related tables, with each table consisting of rows and columns. Relationship between
tables is established by using the concept of keys (Primary Key and Foreign Key).
b> Hierarchical Data Model: A hierarchical data model is a way of organizing data in a tree-like
structure, where each record is a parent or child of one or more other records. This structure is
similar to an organizational chart, where each record is a parent of one or more child records, and
each child record is a parent of one or more child records.
In a hierarchical data model, each record has a unique identifier, also called a primary key, and
one or more fields that store the data for that record. This model is more suitable for one-to-
many types of relationship between records. It is not flexible for the data retrieval and
manipulation. It is also not efficient for large and complex databases.
c> Network Data Model: The network model is a type of data model that represents data as a
collection of records and relationships. Network model allows for many-to-many relationships.
In the network model, records are represented as nodes and relationships are represented as links
between nodes. Each node has a unique identifier, also called a record number, and can have
multiple links to other nodes. The relationships are defined by link types and link sets, which
specify the type of relationship and the number of links between nodes.
d> Flat-File Model: A flat-file model, also known as a flat-data model, is a type of data model that
stores data in a single table or file, with no nested or related structures.
e> Object-Oriented Data Model:
f> Conceptual Data Model:
g> Physical Data Model: etc.
Relational Data Model based Definitions
1. Entity: An entity is something that exists and about which we can store some information. It is an object
which can be distinctly identified. For example, student entity, employee entity, item entity, etc. Entity
becomes the name of the table.
2. Attribute: A column in a table of a relational database is called an attribute. It represents a set of values
of a particular type.
3. Tuple: Each row in a table is known as tuple. It is also called a row/record. A record in a table represents
a set of related data.
4. Table: Tables are the building blocks of a database to store data. A table consists of several records/rows,
where each record is composed of several fields/attributes/columns. A table is also known as Relation.
5. Cardinality of Relation: It is the number of records or tuples in the relation.
6. Degree of Relation: Number of columns or attributes is known as degree of a relation.
7. Domain of Relation: It defines the kind of data represented by the attribute. It is the set of all possible
values that an attribute may contain.
8. Primary Key: It is column of a table in relational database, which uniquely identifies each row of the
table. In some RDBMS, more than one column can also be specified as Primary Key. Primary Key field
does not allow NULL value and repeated values.
9. Foreign Key: It is a column or a set of columns of a table, which has a reference to one or more columns
in another related table.
10. Candidate Keys: The columns of a table, which may be set as Primary key, are known as Candidate
Keys.
11. Alternate Keys: The columns of a table, which can be set as Primary Key, but are not currently set as
Primary Key, are known as Alternate Keys.
12. Composite Key: If Primary Key of a table is composed to two or more columns of a table then it is
termed as Composite Key.
Characteristics of Database Management System (DBMS)
1> Data analysis can be done more efficiently.
2> Organized storage of data.
3> Sharing of data can be done.
4> Data security is maintained.
5> Integrity of data (Data accuracy and data validity) is maintained.
Characteristics of Relational Database Management System (RDBMS)
(The characteristics of DBMS are inclusive. These are some additional characteristics)
1> Data redundancy (repetition) is minimized.
2> Data inconsistency is avoided. (consistency of data ais maintained.)
3> Data standard is maintained.
Introduction to SQL (Structured Query Language)
SQL is the standard language supported by all RDBMS software. SQL contains commands to create
databases, create tables of the database, manipulate data of tables, retrieve data from the tables, grant and
revoke permissions etc.
SQL commands have been categorized into DDL (Data Definition Language), DML (Data Manipulation
Language) and TCL (Transaction Control Language)
DDL commands are mostly used to create, modify and delete the structure of database tables. CREATE
TABLE/DATABASE, ALTER TABLE and DROP TABLE are the DDL commands.
DML commands are used to manipulate (update and delete) and retrieve the desired data from the tables of
database. SELECT, INSERT, UPDATE and DELETE are the DML commands.
Introduction to Libreoffice Base
It is the RDBMS software of Libreoffice suite.
Base is a free and open source database component of LibreOffice suit.
It can be downloaded from www.libreoffice.org
Default database file name is New Database1.odb in Libreoffice Base.
Default location to save a Base database file is Documents within C: Drive.
When Libreoffice is loaded, then “Database Wizard” is activated. This wizard allows the user to
careate a new database file or to open an existing database file or connect to a database stored on
a server.
When a new database file is created then it needs to be registered with Libreoffice.
Database Window: It is the window of the open database, which contains all components of the database.
All works related to the open database file are performed with the its database window.
Components of Libreoffice Database file: There are four components of a Libreoffice database file:
A> Tables B> Queries C> Forms D> Reports
These components are also known as Database Objects. They are displayed in the left pane of the
database window.
Table: A tables is a database object to store data. Relationship between two tables (from parent table to
child table) is established by using the menu option Tools >> Relationship…
Query: A query is a database object, which retrieves and displays the desired data from one or more than
one table(s) of the database file. Retrieval and display of the desired data is done by using using SELECT
command of SQL.
Form: A form is a database object having a GUI interface, which enables the user to enter and store data in
the tables of the database. Data stored in the tables can be edited also.
Report: It is a database object, which retrieves data from a table or a query and displays in a formatted way,
along with some summary information.
Methods to Create a Table/Relation in Liberoffice Base
1. Create Table in Design View: In this method, a table is created by typying field/column names,
selecting their data/field types, typing Description about the fields and specifying Field Properties
(attribute values) in a window. Desciption is optional. This is the most powerful method of creating a
table.
Commonly used data types are, CHAR, VARCHAR, LONGVARCHAR, INTEGER, FLOAT, BIGINT,
DECIMAL, BINARY (to store images, photos, music files, video files), DATE, TIME, BOOLEAN,
BLOB etc. (Study from NCERT book for details on this topic.)
Field Properties (Attributes) of a column of a table: They are the characteristics and restrictions
applied on a field to validate data entry.
Entry Requried, Length, Default Value, Auto Value and Decimal Places are the Field Properites.
Format Example is also a Field Property. (Study from NCERT book for details on this topic.)
The structure of an existing table can be changed by using Design View.
Right clicking of a table name and clicking on Edit option opens a table in Design.
A field or column of a table can be set as Primary Key in Design View.
To make a field Primary Key, open the table in design view, right click on the field name
and click on Primary Key option in the pop-up menu.
Tools >> Relationship… menu option is used to set relationship between two tables. This
menu option activates Relationship dialog box.
To set relaionship between two tables, fileds of the two tables for setting relationship must be
of the same data type.
If relationship is set from Table1 to Table2 then Table1 is called Parent/Primary Table and
Table2 is known as Child/Reference/Foreign Key Table. The column of Table1 used to set
relationship is called Primary Key while the column of Tabl21 used to set relationship is called
Foreign Key.
2. Use Wizard to Create Table: In this method, a table is created by selecting the desired table category,
table name, field names, field type and other options such as Primary Key field, by using pre-defined set
of options. After creating a table, the table can directly be opened in datasheet view to enter and edit
data.
Datasheet View of a Table: It is the view in which the records of a table can be entered, edited, deleted,
sorted, filtered and navigated.
In the Datasheet Window of a table, there is Navigation Box at the bottom of the window.
Components of Navigation Box:
A> Record Selector Box: This box displays the record number of the active record. A user can type any
other valid record number in this box to activate the record.
B> Navigation Buttons: Thre are four navigation buttons in this components, which are named as Move to
First Record, Move to the nest Record, Move to the previous record and Move to the last record of the table.
In addition to these two methods, Execute SQL Statement window can also be used to create a table.
Execute SQL Statement window, can be activated by clicking on the menu option Tools >> SQL…
Note
SQL (Structured Query Language) is a standard language, which contains a set of commands to create
and manipulate table structure, enter, update and delete data in tables, make queries, create view,
SQL is embedded in all Relational DBMS software such as Libreoffice Base, OpenOffice Base, MS-
Access, MySQL, SQL Server, SQLLite, Oracle etc.
CREATE TABLE command of SQL is used to create a table.
ALTER TABLE command of SQL is used to change the structure of a table.
SELECT command of SQL is used to make queires.
DELETE command of SQL is used to delte the desired records from tables.
DROP TABLE command of SQL is used to delete a table.
UPDATE command of SQL is used to edit/update the field/column values of table.
Referential Integrity: It is set of rules, which ensures data integrity, data accuracy and data consistency in
inter-related tables. Referential integrity requires that, whenever a foreign key value is used it must
reference a valid, existing primary key in the parent table.
Referential integrity prevents users from:
Adding rows to a related table if there is no associated row in the primary table.
Changing values in a primary table that result in orphaned records in a related table.
Deleting rows from a primary table if there are matching related rows.
Types of Relationships
A> One-to-One Relationship: In this type of relationship, there is only one related record in the
child/foreign key table for each record in the parent/primary key table and vice-versa.
B> One-to-Many Relationship: In this type of relationship, there may be one or more related record(s) in
the child/foreign key table for each record in the parent/primary key table but a record in the child/foreign
key table has one one record corresponding record in the parent/primary table.
C> Many-to-Many Relationship: In this type of relationship, there may be multiple related records in the
child/foreign key table for each record in the parent/primary key table and vice versa.
Methods to Create a Query in Liberoffice Base
A> Create Query in Design View B> Use Wizard to Create Query
C> SQL View method (Use Execute SQL Window to create a Query by typing SELECT command)
Methods to Create a Form in Liberoffice Base
A> Create Form in Design View B> Use Wizard to Create Form
Methods to Create a Report in Liberoffice Base
A> Create Report in Design View B> Use Wizard to Create Report
Differences between Query and Report:
1> Output of a Query is unformatted and does not contain additional information such as headings,
summary report but Output of a Report is formatted and contains additional information such as headings,
summary report.
2> A query can be generated by using one table, more the one table, one query or more than one query but a
report is generated from one table or one query only.
3> Criteria can be applied to generate a query so that only desired records can be displayed but criteria
cannot be applied to generate a report and all records of a table or a query are displayed.
================================= ************ ===============================