0% found this document useful (0 votes)
15 views4 pages

Queries Chapter 5

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 4

QUERIES CHAPTER 5

Query:

The word Query is derived from the English word Question and Inquiry. Which means to ask, i.e. to get information about
someone. Query in Microsoft X MS Access is used to view existing data, find required data, change existing data and
analyze data and based on this Query Forms and Reports are created. Can also be prepared.

For example, if we want to find a specific record in the existing data, we use the Query object of MS-Access. For example,
suppose we have to select only those students who have passed from the result data of all students. Similarly, if we need
to change any record in the existing data, for example, if the address of a student changes, then in the data. We also have
to use Query to make this change.

Query refers to getting some information regarding the store data in the table and performing some action on data.

MS Access allows us to create many types of queries. Which are as follows:

1. Select Query 2 Parameter Query (Parameter Query) 3 Cross Tab Query 4- Action Query (Action Query)

1 Select Query:

This is the most used query. This Query retrieves the required data from one or more files.

Shows space together. We know that a well-designed data is often more data about an object

It is stored in more than one wallet, so searching for your required data separately in multiple wallets is quite tedious and
time consuming.

It is a difficult task and this purpose is well served by Select Query.

How to make select query :

With the help of design view:

1. Open database
2. Click on queries
3. in the main database window select create query in design view
4. show table dialogue box will appear in it tables list will appear
5. select the tables and then click on close button
6. in the next there are different options are avail for to make query
7. "Double-click on the required fields in the tables to add them to the query."
8. . If you want to view yours in a specific order (Descending or Ascending), select Descending Ascending in the desired
column through the Sort option in the query grid
9. If you want to look at a specific record, use the Query Design Grid. Enter the conditions in the required field by
Criteria.
10.To save the query, click the Save button in the standard toolbar or click Save in the File menu, and the Save As
dialog box will open. Type the name of the query in it and click the Ok button.
11.Click run button
12.Results will shown

Creating a Query through the Query Wizard:

Follow these steps to create a Select Query using the Query Wizard:

1. In the Main Data window, click on "Queries" from the list of Objects.

2. Click "New" in the standard toolbar of the main data window. The "New Query" dialog box will appear. Select "Simple
Query Wizard" and press the "OK" button. Alternatively, double-click the "Create Query by Using Wizard" option in the
right part of the main data window.
3. The "Simple Query Wizard" dialog box will open. In the "Table/Queries" section, select the tables or queries to use in
the query from the list.

4. In the "Available Fields" list, select the required fields using the arrow buttons:

> (Add a field) < (Remove a field)

> (Include all fields)

<< (Remove all fields

Parameter Query :

A parameter query is a type of query that prompts the user for input data through a dialog box when it's run. This input
data is then used as criteria to generate results. The input provided by the user is called a parameter, and multiple
parameters can be used in a single query.

Parameter queries are particularly useful when creating forms and reports. For example, suppose you want to generate a
monthly sales report. You can create a query to view monthly sales and then create a report based on this query. When
you run the report, a dialog box will appear, allowing you to enter the desired month and generate the sales report for
that month.

Creating a Parameter Query:

1. Open the required data and click on "Queries" from the list of Objects.

2. Click "New" in the main data window's standard toolbar and select "Create Query in Design View".

3. Add one or more tables from the "Show Tables" dialog box.

4. The Query Design Grid will appear with fixed columns at the top. Choose the required fields from the section below.

5. In the "Criteria" section, write a message in square brackets instead of a value between the required fields. This
message will appear as a runtime dialog box, prompting the user for input.

6. Write the rule number in brackets below the field and in front of the criteria row."

7. save the query and then double click on query to run

8. a dialogue box will appear enter roll no there

9. type roll no

10.DBMS show record

Crosstab Query:

A Crosstab Query is used to compare and analyze data from two groups. One group is displayed in rows, while the other is
displayed in columns. This query allows you to examine different types of data and perform arithmetic operations like
addition, averaging, and more.

Benefits of Crosstab Query:

Crosstab Query helps you compare and analyze data by arranging it in rows and columns. For instance, if you want to see
the number of items sold on different dates, a Crosstab Query is ideal.

Creating a Crosstab Query

To create a Crosstab Query, follow these steps:

1. Open your database.

2. In the Main Data window, click on "Queries" from the list of Objects.

3. Click "New" in the main data window, and the "New Query" dialog box will appear. Select "Crosstab Query
Wizard" and click "OK".
4 .Select your table and click the "Next" button.

5. From the list of available fields, use the arrow button to select the field whose data you want to display in the book, and
then click the "Next" button.

6. Now, select the field that you want to display as a column and click "Next" again."

7.type the name of cross tab query then ok results will show on sacreen

Action Query :

An Action Query is a type of query that allows you to modify records in a database and move records from one place to
another. There are four types of Action Queries:

1. Delete Query: Deletes records from a database table.

2. Update Query: Modifies existing records in a database table.

3. Append Query: Adds new records to a database table.

4. Make Table Query: Creates a new table from existing data in a database.

Use of

In a query, criteria are used to retrieve specific records. When we apply criteria to a query, it will only display the records
that meet the specified conditions, rather than showing all the records in the table.

For example, we might want to view only the records of students who have passed or only the customers who live in
Muzaffargarh city. To apply criteria in a query, we need to use operators.

Short answers of the questions


1- Purpose of Ms access query:

The purpose of a query in Microsoft Access is to find and work with data in a database. Queries can be used to
find a specific records in database

2- Types of qury:
1- Select query
2- Parameter query
3- Crosstab Curie
4- Action query
3- Select query:

A select query is a database object that shows information in Datasheet view. A query does not store data, it
displays data that is stored in tables. A query can show data from one or more tables, from other queries, or from
a combination of the two.

4- Cross tab query:

A crosstab query calculates a sum, average, or other aggregate function, and then groups the results by two
sets of values— one set on the side of the datasheet and the other set across the top.

5- Parameter query:

A parameter query is a query that, when run, first retrieves data from you using a dialog box and
sets conditions on that data.

6- Action query:

Action queries are queries that make changes to many records at once. They are used to delete records, to
update records

1. What is meant by Wild Card?:

A wildcard is a special character used to represent one or more characters in a search query.
2. What is the use of Asterisk in Wild Cards?:

The asterisk (*) is used to represent any number of characters in a wildcard search.

3. What is the purpose of Question Mark in Wild Cards?:

The question mark (?) is used to represent a single character in a wildcard search.

Action Queries

1. What are the types of Action Query?:

There are four types of Action Queries:

1. Delete Query

2. Update Query

3. Append Query

4. Make Table Query

Delete and Update Queries

1. What is the purpose of Delete Query?:

A Delete Query is used to delete records from a database table.

2. What is the purpose of Update Query?:

An Update Query is used to modify existing records in a database table.

Make Table Query

1. What's the purpose of Make Table Query?:

A Make Table Query creates a new table from existing data in a database.

Forms and Reports

1. Write two characteristics of Forms and Reports:

1. They are used to display and interact with data in a user-friendly way.

2. They can be customized to meet specific needs and display data in a specific format.

Criteria and Number Sign

1. What is meant by Criteria?:

Criteria refer to the conditions or rules used to filter or select specific data in a query.

2. What is meant by Number Sign (#)?:

In Access, the number sign (#) is used as a wildcard character to represent dates or times in a query.

You might also like