Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
sec2_second_term_2013_doc.doc
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
1.84 Mб
Скачать

Create a new query without a wizard

The following dialogue box appears:

Select (Design View) then press (ok) so (Query Design) appears as in the figure:

- When we start the design, a window of adding the required tables to the query

appears. In this query, data from department and employee tables are required.

- Select department and employee table then click close, so (Design Query)

appears as shown in the figure.

Move the required fields as follows:

Drag the required field from the table to the column downward.

Alternatively, Double click on the required field.

T herefore, (design view) appears as follows:

Save the query, and then press (open) to see the result.

The calculated field

Through the following exercise, we will learn how to make the calculated field.

Exercise 3: Modify query "e2" by adding field under the name of incentive (10% of

the salary) and save it under the same name.

Open (Query e2) in (design view)

Instead of editing the required mathematical expression manually, we will use

what is called (Expression Builder) that helps us write and select fields away from the

spelling mistakes in the field name that may cause many mistakes.

Click the right hand of the mouse as in the following figure, so the following short

m enu appears

Select (Build) so (Expression Builder) appears as follows:

Select salary field, and move it to an edit area by selecting (Paste Button) or by

double click on it.

Press (Multiplication Sign) then edit. 0. 10

Click (Ok)

R un Query icon from in the toolbar

To change the column title to (incentive) per cent we will return to (Query Design) from

t he icon then from the (Short menu) of the calculated field, select properties as

follows:

Run the (Query) another time, what do you see?

Save the (Query) then close.

Exercise:

Design a query named "pl", to display project code, project name, the employee

name, main salary, the number of hours and hour fee (5% of salary) and the due total

(the number of hours multiplied by the hour fee). The Query data appear as follows:

Adding conditions for the Query:

Exercise 4:

Design a query "c1" to display (employee name- main salary) for the department

whose code is two.

To design this query, we follow the same steps in the previous exercises and we add

a condition under (field code) as in the following figure:

Creating a Query with parameters:

Exercise:

Modify the query "c1" to display (employee name – main salary) for the

department code that will be inserted on running the query and save it as "C2"

This query will ask for the department code on opening and running it by editing

the message that appears in the condition area between [] as in the following figure:

Run the Query, so the following message appears:

Insert Number 1 and click ok.

Exersise7:

Design a query to display (data) of the employees whose salaries 250 pounds or

more and save it as c3.

In this query, the formula will be >=250 and edit it under salary.

Exercise 8:

Modify The Query ''c3'' to display all the employees' data working in the project.

Whose code is bm102 and the working hours are less than 10 hours and save it as C4.

In this query, the formulae is compound i.e. the bm102 is put under the project code

and <=15 is put under the field hours number in the same row.

This means that the two formulae should be achieved together.

Exercise 9:

Modify the Query ''c3'' to display all the employees' data who work in the project

whose code is bm102 or the number of the working hours are less than ten hours and

save it as C4.

In this Query, there is a compound formula. This means achieving one of the

formulae will display any record.

We put (bm102) under the project code field and <=15 under the field of the working

hours in the second row of the formulae area.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]