0% found this document useful (0 votes)
5 views

ComputerApplication

The document provides an overview of databases, their management systems (DBMS), and the relational database model, highlighting the importance of data organization, retrieval, and relationships between tables. It details the functionalities of LibreOffice Base, including creating databases, tables, and queries, as well as the types of data and relationships that can be established. Additionally, it explains the advantages of using a DBMS and the significance of maintaining data integrity and consistency.

Uploaded by

inispree.444
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

ComputerApplication

The document provides an overview of databases, their management systems (DBMS), and the relational database model, highlighting the importance of data organization, retrieval, and relationships between tables. It details the functionalities of LibreOffice Base, including creating databases, tables, and queries, as well as the types of data and relationships that can be established. Additionally, it explains the advantages of using a DBMS and the significance of maintaining data integrity and consistency.

Uploaded by

inispree.444
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

1.

Introduc on to Databases

 Databases are used for storing, manipula ng, and managing data in various fields of life,
such as booking ckets, library management, banking transac ons, and more.

 Data can be in mul ple formats, including text, images, audio, and video. These are
processed to generate useful informa on.

2. Data and Informa on

 Data: Raw facts and figures, such as marks, prices, or names.

o Examples: Marks scored by students, product prices, etc.

 Informa on: Processed data that is meaningful and organized, such as a report card or an
invoice.

o Example: Temperature data processed to find the maximum or minimum


temperature.

3. Databases and DBMS

 Database: A collec on of logically related data, stored systema cally to allow easy retrieval
and management.

 DBMS (Database Management System): So ware that helps in crea ng, upda ng, and
retrieving data in a database.

o Examples: MS Access, LibreOffice Base, Oracle, MySQL.

Advantages of DBMS:

 Organized Storage: Data is stored efficiently for quick retrieval.

 Data Analysis: Allows analysis based on criteria (e.g., finding averages, max/min values).

 Data Sharing: Data can be shared across different applica ons.

 Reduced Data Redundancy: Minimizes repe ve data in mul ple tables.

 Data Consistency: Ensures uniformity across tables (e.g., upda ng a name in all tables where
it appears).

 Efficiency: Organizes tables for fast saving, reading, and searching.

 Accuracy and Validity: Ensures accurate retrieval by minimizing errors and se ng valida on
rules.

 Security: Unauthorized access can be restricted using passwords and encryp on.

4. Data Models

 Data Model: Describes how data is stored and retrieved in a database.

 Types of Data Models:


o Hierarchical Model: Organizes data in a tree-like structure, where records are linked
at different levels.

o Network Model: Uses a more flexible structure where mul ple records can be linked
to the same master file (like an inverted tree).

o Rela onal Model: Data is stored in tables with rows and columns, and rela onships
are formed between these tables.

5. Rela onal Database Model

 Proposed by E. F. Codd (1970), this model organizes data into tables (rela ons) made of rows
(records) and columns (fields).

 En es: Real-world objects (e.g., Student, Employee).

o A ributes: Characteris cs of en es (e.g., Name, Date of Birth).

Key Terminology in Rela onal Databases:

 Primary Key: Uniquely iden fies a row in a table (e.g., Roll Number for a Student table).

 Foreign Key: A field in one table that refers to the primary key in another table, establishing a
rela onship.

 Candidate Key: Any field that can uniquely iden fy a row in a table.

 Alternate Key: Candidate keys that are not chosen as primary keys.

6. Database Objects in RDBMS

 Table: The core object in a DBMS where data is stored in rows and columns.

 Forms: User-friendly interfaces for data entry, allowing users to input data easily into tables.

 Queries: Used to retrieve specific informa on from the database based on criteria (e.g.,
retrieving students who scored above 50).

 Reports: Formal output of queries, usually presented in a structured format for be er


presenta on.

Summary

 Data refers to raw facts, and Informa on is processed data that provides meaningful
insights.

 A Database stores related data efficiently and can be managed using a DBMS.

 Rela onal Databases store data in tables and use keys to form rela onships between tables.

 Primary Key uniquely iden fies records, and Foreign Keys link records across tables.
 DBMS provides various objects like tables, forms, queries, and reports to manage and
retrieve data effec vely.
Introduc on to LibreOffice Base

 LibreOffice Base is a free, open-source Database Management System (DBMS), available for
both Windows and Linux opera ng systems.

 It is used for crea ng, managing, and manipula ng databases, helping users store and
organize different types of data such as text, numbers, and dates.

Data Types in LibreOffice Base

 Data types specify the kind of data that can be stored in a field. Understanding the right data
type for each field ensures proper data handling and storage.

Common Data Types

1. Text Data Type

o Stores le ers, numbers, and special characters.

o No arithme c opera ons can be performed.

o Examples: Name, PAN card number, etc.

o Variants of Text Data:

 Memo (LONGVARCHAR): Stores up to 64,000 characters.

 Text (CHAR): Fixed length, used for things like passport numbers.

 Text (VARCHAR): Variable length, e.g., for addresses.

2. Numeric Data Type

o Used to store numbers (integers and real numbers) on which arithme c opera ons
can be performed.

o Types of Numeric Data:

 TinyInt: 0 to 255

 SmallInt: -32,768 to 32,768

 Integer: -2.14×10^9 to 2.14×10^9

 BigInt: Large range of values.

 Float/Real: For decimal numbers, includes scien fic nota on.

3. Currency Data Type

o Used for monetary values.

o Example: $100, ₹50.25.

4. Date Data Type

o Stores date and me values.

o Types of Date Data:


 Date: Year, Month, Day.

 Time: Hour, Minute, Second.

 Timestamp: Both date and me.

5. Boolean Data Type

o Can store two values: True/False, Yes/No, or On/Off.

6. Binary Data Type

o Stores digi zed images or sounds, o en in the form of binary data (1s and 0s).

Crea ng a Database in LibreOffice Base

1. Star ng LibreOffice Base

o Open LibreOffice Base via Start Menu (Windows) or the applica on menu (Linux).

o You can choose to create a new database or open an exis ng one.

2. Database Crea on Process

o Step 1: Select Create a new database in the wizard.

o Step 2: Choose whether to register the database (op onal).

o Step 3: Click Finish and save the file with a .odb extension.

o Step 4: Name the database (e.g., "Sports Day") and save.

User Interface of LibreOffice Base

 Title Bar: Shows the name of the database.

 Menu Bar: Contains op ons like File, Edit, View, etc.

 Standard Toolbar: Provides quick access to frequently used tools.

 Status Bar: Displays the current view of the database.

 Database Pane: Displays database objects like Tables, Forms, Queries, Reports, etc.

Crea ng a Table in LibreOffice Base

1. Using the Table Wizard

o Open the database and select Use Wizard to create a table.

o Choose a sample table or create a custom one by adding fields.

o Assign field types, set proper es, and specify a Primary Key.

2. Design View
o Allows crea ng a table from scratch with custom fields.

o Set Field Names, Field Types, and Field Proper es like Length, Default Value, and
Format.

o A er defining fields, set a Primary Key by right-clicking and selec ng Primary Key.

3. Saving the Table

o Click Save or use Ctrl + S to save the table.

Entering Data into a Table

1. Entering Data

o Open the table and begin typing in the fields in datasheet view.

o Use the Tab key to move from one field to another.

2. Naviga on

o The Naviga on Box at the bo om helps move between records. It shows the current
record number.

o Use the Record Selector Box and Naviga on Bu ons to scroll through records.

3. Edi ng Data

o To modify exis ng data, click on the field and edit.

o Use the Esc key to cancel changes.

4. Dele ng Records

o Select a record and press Del or right-click and choose Delete Record.

5. Sor ng Data

o To sort data, select the field and click the Sort Ascending or Sort Descending bu on
in the toolbar.

Prac cal Example: Crea ng a "Sports Day" Database

 Table Name: Events

 Fields:

1. Event_Id (Varchar)

2. Event Name (Varchar)

3. Date (Date)

4. Winner 1 Name (Varchar)

5. Winner 1 Points (Numeric)


 Primary Key: Event_Id (Unique iden fier for each event).
Edi ng and Dele ng Tables

1. Edi ng Tables:

o To edit a table, right-click on the table name in the database pane and select "Edit."

o Changes include adding, removing, or altering fields.

o Modifica ons do not affect exis ng records.

2. Dele ng Tables:

o To delete a table, right-click and select "Delete."

o A confirma on prompt will appear; click "Yes" to confirm dele on.

3. Renaming Tables:

o Right-click the table name, select "Rename," and type the new name.

Rela onships Between Tables

1. Purpose:

o Rela onships prevent data redundancy and inconsistency.

o They ensure accurate and consistent data entry across related tables.

2. Prerequisite:

o There must be a common field (e.g., Admission No in both tables) to create a


rela onship.

3. Example:

o Student_Details table has Admission No as primary key.

o Student_Result table has Admission No as foreign key, crea ng a rela onship.

4. Types of Rela onships:

o One-to-One: One record in the master table corresponds to one record in the
transac on table.

 Example: Student and their Admission Number.

o One-to-Many: One record in the master table corresponds to mul ple records in the
transac on table.

 Example: One teacher can teach mul ple students.

o Many-to-Many: Mul ple records in the master table correspond to mul ple records
in the transac on table.

 Example: A teacher may have mul ple roles, each related to mul ple
students.
Advantages of Rela ng Tables

 Prevents Data Redundancy: Data is not repeated across tables.

 Referen al Integrity: Ensures data in the foreign key field matches the primary key in the
master table.

 Data Valida on: Ensures no invalid data is entered in the related fields.

 Automa c Updates: Changes in the master table reflect in the transac on tables.

Referen al Integrity

1. Principle: No unmatched foreign key values should exist.

o For instance, if a record with Admission No 1001 is deleted in the master table, it
should not appear in the transac on table.

2. Op ons to Maintain Referen al Integrity:

o No Ac on (default): Prevents updates or dele ons if related records exist.

o Update Cascade: Updates or deletes the referenced field and related records.

o Set NULL: Assigns a NULL value to related fields when the master record is
deleted/updated.

o Set Default: Assigns a default value to related fields when the master record is
deleted/updated.

Steps to Create a Rela onship

1. Example Setup:

o Add a CategoryID field to the Events table and a new EventCategory table with
CategoryID as the primary key.

o Create a rela onship between CategoryID in Events (foreign key) and EventCategory
(primary key).

2. Steps:

o Open Tools > Rela onships in LibreOffice Base.

o Add both Events and EventCategory tables to the Rela onship Design window.

o Drag CategoryID from Events to EventCategory to establish the rela onship.

o Set rela onship proper es (e.g., One-to-Many).

Types of Rela onships Recap


1. One-to-One: One record in the master table corresponds to one record in the transac on
table (e.g., Ci zen and Driving License).

2. One-to-Many: One record in the master table corresponds to mul ple records in the
transac on table (e.g., Customer and Product).

3. Many-to-Many: Mul ple records in the master table correspond to mul ple records in the
transac on table (e.g., Teacher and Student).
Effec ve Notes on Queries in LibreOffice Base

Introduc on to Queries

 Purpose: Queries help retrieve and display data from one or more tables in a database.

 What is a Query?: A query is a ques on or request made to the database to fetch specific
data, based on certain criteria.

 Why Use Queries?: They simplify data retrieval, making it easier to search through large
datasets.

Crea ng Queries in LibreOffice Base

Queries are essen al for data manipula on and retrieval in a database. In LibreOffice Base, you can
create queries in three ways:

1. Using a Wizard

2. In Design View

3. In SQL View

Types of Queries

1. Queries Using a Wizard:

o Step-by-Step Process: The wizard guides you through selec ng fields, applying
sor ng and filtering criteria, and customizing the query.

o Example: For a sports database, a query can display the Event Name and Winner for
events with CategoryID = C001.

2. Queries in Design View:

o Provides more flexibility and control compared to the wizard.

o Allows you to design complex queries involving mul ple tables and various filtering
op ons.

o Example: Display Event Name, Winner, and Category Name from Events and
EventCategory tables.

o Alias: You can change the display names of fields (e.g., "Winner" to "Winner Name").

o Sor ng: Allows sor ng the results by specific fields (e.g., sor ng by Event Name in
ascending order).

3. Queries Using SQL View:

o Allows wri ng raw SQL queries for even more control and customiza on.

o Best for advanced users who need to perform complex queries.


Crea ng a Query Using a Wizard (Step-by-Step)

 Step 1: Open the database and go to the Queries sec on.

 Step 2: Click Use Wizard to Create Query….

 Step 3: Select the table(s) and fields to be included in the query.

 Step 4: Choose any sor ng preferences (if needed).

 Step 5: Define criteria for filtering records (e.g., CategoryID = C001).

 Step 6: Assign Alias Names for readability (e.g., "Winner" to "Winner Name").

 Step 7: View the summary of the query and finish.

Crea ng a Query in Design View

 Step 1: Open Query Design View.

 Step 2: Add the required tables.

 Step 3: Select the fields to be displayed in the query results.

 Step 4: Set sor ng op ons and apply filtering criteria.

 Step 5: Click Run to view results.

 Step 6: Save the query with a meaningful name.

Edi ng a Query

 Step 1: Right-click the query name in the Objects pane and select Edit.

 Step 2: Modify the query by changing fields, adding condi ons, or applying different sor ng.

 Step 3: Run and save the query a er edits.

Working with Numerical Data in Queries

 Func ons: You can apply func ons to numerical data like Count, Sum, Min, Max, and
Average.

 Example: Create a query that calculates the average points for each category of events.

o Select Category Name and Points fields.

o Apply the Average func on to the Points field and the Group func on to the
Category Name field.

 Filtering: Add condi ons to display specific groups (e.g., Category = Athle cs).
Summary of Key Points

 A query retrieves and displays data from tables in a database.

 Queries can be created using:

o Wizard (easy for beginners),

o Design View (more flexible),

o SQL View (for advanced control).

 You can filter data using criteria, apply sor ng, and even perform mathema cal func ons like
average, sum, and count.

 Queries help organize and simplify the process of retrieving and displaying specific data from
large datasets.

Prac cal Exercises

1. Create a Query for Maintenance Dues:

o Tables: Residents Details, Maintenance Dues.

o Fields to Display: Flat No, Owner, Receipt Number, Date, Amount.

2. Create a Query for Hostel Records:

o Tables: Student Details, Room Details.

o Fields to Display: Room No, Student Name, Category, Monthly Rent.

3. Create a Query to Display Total Monthly Rent by Category:

o Aggregate the total Monthly Rent collected for each Category (e.g., AC, Non-AC).
Introduc on to Forms and Reports

 Forms provide a user-friendly interface for data entry and modifica on, making them
essen al for users who are not well-versed with computers. They are visually organized and
allow for easier data entry compared to the data-sheet view.

 Reports display retrieved data in a well-forma ed, readable manner.

 Forms and reports are objects in the LibreOffice Base interface, located in the Database
Pane.

Forms in LibreOffice Base

 Forms serve as the front end for interac ng with the data stored in tables.

 Field Controls are used to display and enter data, with each field having a label (text
describing the data) and a field value text box (for entering data).

 Forms can contain addi onal elements like text, images, and other controls (e.g., list boxes,
radio bu ons).

Crea ng a Form Using the Form Wizard

The simplest way to create a form is by using the Form Wizard:

1. Step 1: Open the database and select the Form icon from the Database Pane. Choose Use
Wizard to Create Form.

2. Step 2: Select the table (e.g., Events table) from which the form will be created.

3. Step 3: Shi the fields from the "Available Fields" list to the "Fields in the Form" list.

4. Step 4: Skip subform setup if not needed and proceed to the next step.

5. Step 5: Choose the layout of the form. Op ons include columnar display (with labels on the
le or top).

6. Step 6: Define the form's purpose: for data entry, viewing, or both.

7. Step 7: Select the form's appearance, such as border style and background color.

8. Step 8: Name the form and specify whether you wish to modify it a er crea on.

9. Step 9: Finish the wizard and the form is ready to use.

Modifying a Form

A er crea ng a form, modifica ons can be made:

1. Changing Background Color:

o Right-click on the form and select Page Style. Choose the Area tab to pick a color.

2. Edi ng Labels:

o Right-click the label (e.g., EventID) and select Control Proper es to change the label
text and forma ng.

3. Moving Controls:
o Click and drag controls to new posi ons. To move only the label or text box, hold Ctrl
while selec ng.

4. Resizing Controls:

o Select the control and drag its size handlers to adjust.

5. Adding Tool ps:

o Tool ps help users by displaying a helpful message when the cursor hovers over a
control. Right-click the control, go to Control Proper es, and add text in the Help
Text field.

Forms Controls Toolbar

This toolbar allows you to add and edit controls:

 Adding a Calendar for Date Fields:

o Select the date field, enable the DropDown property, and the date field will show a
calendar.

 Adding Text to the Form:

o Use the Label tool to add tles, headings, or subheadings to the form.

Adding and Edi ng Data

 Viewing the Form:

o Toggle between Design View and Form View to interact with the form.

 Adding a New Record:

o In Form View, click the New Record bu on to enter new data.

 Dele ng a Record:

o Navigate to the record and click the Delete bu on.

Design View vs. Form View

 Design View allows you to create and adjust the layout.

 Form View is used to interact with the data, add, or modify records.

Crea ng a Report in LibreOffice Base

A report in a database management system (DBMS) is used to display retrieved data in an a rac ve
and customized format. Unlike simple tables, reports allow for be er presenta on and organiza on
of data, which can be especially useful when displaying results from mul ple tables. Here's a step-by-
step guide to crea ng a report in LibreOffice Base using the "Events" table from the "Sports Day"
database.

Steps to Create a Report:

1. Open LibreOffice Base:

o In the LibreOffice Base User Interface, click on the Reports icon in the Database
Pane.

2. Start the Report Wizard:

o From the Tasks Pane, click Use Wizard to Create Report.

3. Report Wizard and Dialog Boxes:

o The Report Wizard opens with the Report Builder window and the Add Field dialog
box. For now, focus on the wizard.

4. Select the Table:

o In the wizard, select the Events table from the "Tables or Queries" list. The table’s
fields will be listed in the Available Fields box.

5. Add Fields to the Report:

o Move all the fields from the Available Fields list to the Fields in report list by clicking
the >> bu on.

6. Label the Fields:

o Click Next. The wizard allows you to change field names (for example, to use more
descrip ve names instead of abbreviated field names). Modify these as needed.

7. Grouping Data:

o If you don’t want to group data, click Next. (For example, don’t group by any field at
this stage.)

8. Sor ng the Data:

o In the Sort op ons, you can specify the field by which the data should be sorted. For
example, selec ng EventID and sor ng in Descending order.

o Click Next to con nue.

9. Choose Layout:

o Select a layout for how the report data will be displayed. Choose Tabular layout
(default) and leave the Landscape orienta on.

o Click Next.

10. Finalize Report Se ngs:

o Name the report (e.g., "EventsReport") and select whether you want the report to
update automa cally (Dynamic) or not (Sta c).
o Choose to create the report with the current se ngs and click Finish.

11. View the Report:

o The generated report will appear with the default format.

Enhancing the Report:

While the report generated using the wizard is func onal, it can be further enhanced by adding
controls like tles, date, me, and other forma ng features. Here’s how:

Inser ng Titles and Headings:

1. Access the Report Builder:

o Right-click on the report name (e.g., EventsReport) and select Edit to open the
Report Builder.

2. Add a Title:

o Click on the Label tool in the Report Controls toolbar.

o Drag the label textbox to the report, double-click to open the Proper es dialog box.

o Enter the tle text (e.g., "Annual Sports Day Report") and adjust font style and size.

o Close the Proper es dialog box.

Inser ng Date and Time:

1. Insert Date:

o Click in the Page Header area to ac vate it.

o Go to Insert > Date and Time to open the Date and Time dialog box.

o Select the desired format and click OK.

o The date will be inserted into the Page Header. You can reposi on it by dragging it
within the header.

Grouping Data:

To create a report that groups data by a specific field, such as event categories:

1. Specify Grouping Field:

o In step 3 of the wizard, select a field (e.g., CategoryID) to group the data.

o Move the CategoryID field to the Groupings list.

2. Generate the Grouped Report:

o A er comple ng the wizard, the data will be displayed with records grouped by
category, crea ng a more organized and meaningful report.
Final Report Example:

Once you've followed all the steps, the report will look well-structured with:

 A tle like "Annual Sports Day Report"

 Automa cally generated date and me

 Op onally, grouped data (e.g., events listed by category)

You might also like