THE GOAL • CBSE CLASS 10 • IT 402

Part B — Database Management System using LibreOffice Base

Chapter 11 • Queries in Base

📖 CHAPTER 11 • SOURCE-BASED EXAM NOTES

Queries in Base

Complete exam-oriented revision notes for CBSE Class 10 Information Technology (402), prepared from the uploaded NCERT Domestic Data Entry Operator — Class X (2023–24) textbook.

✍️ Read • Revise • Recall

Source check: Chapter 11 “Queries in Base” starts on printed page 186 of the uploaded textbook. The notes below follow the chapter content, examples, summary and Check Your Progress.

01. Introduction to Queries

What is a Query?

A query is a sort of question asked from a database. It is used to search for desired records and retrieve the required data from one or more tables according to specified conditions.

Why are Queries Required?

As the number of records in a database increases, finding specific information by manually going through each record becomes difficult. A query allows us to retrieve the required information without individually checking every record.

📌 Key Definition

Query: A query is a feature of a DBMS used to retrieve and display data from one or more tables by providing specific search criteria.

What can be specified in a Query?

✏️ EXAM POINT

A query is mainly used to retrieve and display desired information from a database using specific search criteria.

— ✦ — ✦ — ✦ —
02. Query Result and Structure

How is Query Result Displayed?

The result of a query is displayed in tabular form. The field names are displayed in columns and the records are displayed in rows.

Part Meaning
Columns Contain field names / column headings.
Rows Contain the records retrieved by the query.

Example — Student Database

Suppose a Student database contains a Result table. We want to display the names and marks of students who have scored less than 320 aggregate marks.

Requirement Specification
Name of Table Result
Fields Name, Marks
Criterion Aggregate marks should be less than 320
🧠 Remember

Query = Fields to display + Criteria to filter records

— ✦ — ✦ — ✦ —
03. Ways to Create a Query

Three Ways

A query in LibreOffice Base can be created in three ways:

Using a Wizard
Design View
SQL View
Method Important Point
Query Wizard Provides a step-by-step method to create a query.
Design View A more flexible method for creating queries.
SQL View Query can also be created using SQL view.
✏️ VERY IMPORTANT MCQ

Q. How many ways can a query be created in LibreOffice Base?
Answer: Three

Q. Name the three ways.
Using Wizard, Design View and SQL View.

— ✦ — ✦ — ✦ —
04. Creating a Query Using Wizard

Example Used in the Textbook

The textbook uses the Sports Day database containing two tables:

The example query displays Event Name and Winner for events whose CategoryID is C001.

🎯 Query Requirement

Table: Events
Fields: Event Name, Winner, CategoryID
Criterion: CategoryID = C001

Step 1 — Open the Database

Open the Sports Day database. In the Database Design window, click the Queries button present in the Database Pane on the left.

Step 2 — Start Query Wizard

In the Tasks Area, click Use Wizard to Create Query…. The Query Wizard will start.

Step 3 — Select the Table

The first step of the wizard is to select fields from the respective table. Select the Events table from the Tables list box. The corresponding fields are displayed in the Available Fields list box.

Step 4 — Select Fields

Select the required fields and click the right arrow ( > ) button to move them into Fields in the Query. For the textbook example, select:

🧠 Wizard Buttons
  • > → Moves selected field to Fields in the Query.
  • < → Moves field back to Available Fields.
  • » → Moves all fields to Fields in the Query.
  • « → Moves all fields back to Available Fields.
  • ∧ / ∨ → Changes the order of fields.

Step 5 — Set Sorting Order

The next step is to select the sorting order. The result of a query can be displayed in ascending or descending order of a particular field. If no particular sorting order is required, click Next.

Step 6 — Set Search Criteria

The next step is to set the search condition or criterion on the basis of which records will be filtered. For the textbook example:

Field: Events.CategoryID
Condition: is equal to
Value: C001

Match All / Match Any

By default, Match all of the following is selected. If any one of the given conditions should be matched, select Match any of the following.

⚠️ Important Exam Fact

A maximum of three search conditions can be given in the Query Wizard.

Step 7 — Numerical/Summarizing Steps

The wizard contains steps for tasks such as summarizing and performing numerical calculations. If there is no numeric field involved in the query, these steps are not required and can be skipped.

Step 8 — Give Alias

An Alias is an alternative, more readable name used as the column heading in the query output. For example, instead of displaying the field name Winner, we can give the alias Winner Name.

✏️ EXAM POINT

Alias = Alternative / meaningful name of a field displayed as the column heading in query output.

Step 9 — Query Overview

The last step of the Query Wizard displays the entire overview of the query. It shows the work performed during the previous steps in summarised form.

Information Shown in Overview

By default, the query name may be displayed as Query_Events. The default action is Display Query. The Modify Query option can be selected if the query has to be edited in Design View.

Step 10 — Finish

Click the Finish button. The records satisfying CategoryID = C001 will be displayed.

🧠 Wizard Flow

Table → Fields → Sorting → Criteria → Numerical/Summary → Alias → Overview → Finish

— ✦ — ✦ — ✦ —
05. Creating a Query in Design View

Why Design View?

Design View is a more flexible method for creating a query. It can be used to create a query using a single table or multiple tables.

Example from the Textbook

The textbook creates a query to display records of the Athletics category using:

Step 1 — Open Queries

Click the Queries icon in the Objects Pane of the Database Window.

Step 2 — Create Query in Design View

Click Create Query in Design View… in the Tasks Pane. The Query Design Window appears. The Add Table or Query dialog box is displayed.

Step 3 — Add Events Table

Select the Events table and click Add. Alternatively, double-click the Events table. The table is added to the Tables Pane.

Step 4 — Add EventCategory Table

Similarly, add the EventCategory table to the Tables Pane.

Step 5 — Close Dialog Box

Click the Close button in the Add Table or Query dialog box. Both tables are now visible in the Table Pane.

Step 6 — Select Fields

For the textbook example, select:

The selected fields appear in the Design Grid in the lower part of the Query Design Window.

Visible Check Box

The Visible check box is selected by default. This means that the field will be displayed when the query is run. If a field should not be displayed in the output, deselect its Visible check box.

✏️ MCQ ALERT

Q. Is the Visible check box selected by default?
Answer: Yes.

Step 7 — Alias Row

The Design Grid contains an Alias row. It is used to display a meaningful column heading instead of the original field name. Example:
WinnerWinner Name

Step 8 — Sort Row

By default, query data is not sorted. The Sort row is used to arrange records in ascending or descending order. For example, to display Event Name alphabetically, select Ascending under the Event Name column.

Step 9 — Run the Query

After designing the query, click the Run Query button on the toolbar. The shortcut key to run a query is:

⌨️ Shortcut Key

F5 = Run Query

Step 10 — Save the Query

Click the Save button. The Save As dialog box appears. By default, the query name may be Query1. Enter a different name if required and click OK.

Running a Saved Query Again

The saved query appears in the Objects Area of the Database Window. To run the query again, simply double-click the query name. The result will be displayed in a separate window.

🧠 Design View Flow

Queries → Create Query in Design View → Add Table or Query → Add Tables → Select Fields → Alias/Sort/Criteria → Run with F5 → Save

— ✦ — ✦ — ✦ —
06. Query Design Window

Two Main Sections

The Query Design Window is divided into two sections.

Section Purpose
Upper Section / Table Pane Displays the tables or queries added for designing the query.
Lower Section / Design Grid Used to select fields and specify properties such as Alias, Sort, Visible and Criterion.
✏️ VERY IMPORTANT

Query Design Window → Two sections.
This is directly asked in the textbook's Check Your Progress.

— ✦ — ✦ — ✦ —
07. Editing a Query

Why Edit a Query?

After creating a query, its design can be modified. For example, a criterion can be added or changed to display different records.

Steps to Edit a Query

  1. Click the Queries icon in the Database Window.
  2. The list of created queries will appear in the Objects Area.
  3. Right-click the required query.
  4. Select Edit from the drop-down menu.
  5. The Query Design Window will appear.

Example — Athletics Category

To display only records belonging to the Athletics category, type:

Criterion row under Category Name:

Athletics

Applying Numerical Criteria

Suppose we want to display records where the Points scored are more than 10. Add the Points field to the Design Grid and enter:

Criterion:

>10

Relational Operators

The Criterion row can use relational operators such as:

Operator Meaning
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
!= Not equal to
= Equal to
✏️ EXAM POINT

The Criterion row is used to apply conditions for filtering records.

— ✦ — ✦ — ✦ —
08. Criteria in a Query

What is a Criterion?

A criterion is a condition specified in a query to filter the records according to the required value.

Examples

Requirement Criterion
Points more than 10 >10
Points less than 10 <10
Points equal to 10 =10
Points not equal to 10 !=10

Multiple Conditions

The Criterion row can also be used to apply multiple conditions. The required conditions are entered in the appropriate fields of the query design.

📌 Remember

Criterion = condition used to filter records.

— ✦ — ✦ — ✦ —
09. Working with Numerical Data

Numerical Functions in Queries

A query can do more than simply display records. When numerical data is involved, mathematical functions can be used to calculate values.

The textbook mentions functions to find:

Function Purpose
Count Finds the count of data values/records.
Sum Calculates the total of numerical values.
Minimum Finds the smallest value.
Maximum Finds the largest value.
Average Calculates the average value.

Example — Average Points for Each Category

The textbook designs a query to display the average points for each category of events. The required tables are:

Step 1 — Add Fields

Add:
CategoryName from EventCategory
Points from Events

Step 2 — Group CategoryName

Under CategoryName, click the down arrow in the Function row. Select Group. The Group option forms groups for each different data value in the CategoryName column.

Step 3 — Apply Average to Points

Under the Points column, select the Average function.

Step 4 — Run Query

Press F5 to run the query. The query result will show the average points for the categories.

🧠 Numerical Query Flow

CategoryName → Group
Points → Average
Run → F5

Applying a Condition on Groups

A criterion can also be applied to groups. For example, to display the average of only the Athletics category, type Athletics in the Criterion row under Category Name.

✏️ EXAM ALERT

Q. Name any four mathematical functions that can be applied to numerical data in a query.

Answer: Count, Sum, Minimum and Maximum.
Average can also be used.

— ✦ — ✦ — ✦ —
10. Important Terms — One Line Definitions
Term Exam-Oriented Meaning
Query A sort of question asked from a database to retrieve desired information.
Criterion A condition used to filter records.
Alias An alternative/meaningful name used as a column heading.
Design View A flexible method of creating a query from one or multiple tables.
Query Wizard A step-by-step method for creating a query.
Visible Determines whether a selected field will be displayed in the query result.
Sort Used to arrange query results in ascending or descending order.
Criterion Row Row used to specify conditions for filtering records.
Function Row Used to apply functions such as Group and Average while working with numerical data.
— ✦ — ✦ — ✦ —
11. Wizard vs Design View
Query Wizard Design View
Provides a step-by-step procedure for creating a query. Provides a more flexible method for creating a query.
Fields are selected through the wizard's list boxes. Fields are selected directly in the Query Design Window.
Search conditions are specified through wizard steps. Criteria can be entered directly in the Criterion row.
Alias can be assigned through the wizard. Alias can be entered in the Alias row.
Suitable for guided query creation. Useful when more flexibility is required.
✏️ MCQ ALERT

Q. Which is a flexible way to create a query?
Answer: Design View.

— ✦ — ✦ — ✦ —
12. Most Important Exam Questions
📌 MUST PREPARE
  1. Define a query. What is the need of creating a query in a database?
  2. Name the three ways of creating a query in LibreOffice Base.
  3. Explain the steps to create a query using Query Wizard.
  4. What is the use of the Available Fields list box?
  5. What is the use of the Fields in the Query list box?
  6. What is the purpose of setting the sorting order?
  7. What is a criterion in a query?
  8. How many search conditions can be given at the most in the Query Wizard?
  9. What is an Alias? Why is it used?
  10. What information is displayed in the last step of the Query Wizard?
  11. Why are numerical/summarizing steps skipped when no numeric field is involved?
  12. Why is Design View considered a flexible method of creating queries?
  13. What is the use of the Visible check box?
  14. What is the use of the Alias row in the Design Grid?
  15. What is the use of the Criterion row?
  16. Name the relational operators that can be used in the Criterion row.
  17. What is the shortcut key to run a query?
  18. Name any four mathematical functions that can be applied to numerical data in a query.
  19. Explain how the Group function and Average function are used in a numerical query.
  20. How can a saved query be run again?
— ✦ — ✦ — ✦ —
13. Textbook Check Your Progress — Focus

MCQ Topics Directly Asked

True / False Concepts

Fill in the Blanks — Key Answers

Question Concept Answer
A sort of question asked from a database Query
Query result displayed in ______ form Tabular
Number of ways to create a query Three
Query Design Window sections Two
Shortcut key to run query F5
Conditions are set in the ______ row Criterion
Fields displayed after selecting a table in Wizard Available Fields
Sorting order Ascending / Descending
Maximum search conditions in Wizard Three
Last Wizard step displays entire ______ Overview
More flexible method Design View
Column heading instead of field name Alias row
— ✦ — ✦ — ✦ —
14. Practical + Viva Focus

Remember These Actions

🎯 Practical Recall

Fields decide what to display.
Criterion decides which records to display.
Alias decides what column heading to show.
Sort decides the order of records.

— ✦ — ✦ — ✦ —

⚡ CHAPTER 11 — LAST MINUTE RAPID REVISION

🧠 SUPER SHORT FORMULA

QUERY = SELECT → FILTER → SORT → DISPLAY

FIELD → What to display
CRITERION → Which records
ALIAS → Column heading
SORT → Order
F5 → Run