Pitney Bowes MapInfo Professional User Manual

Page 237

Advertising
background image

1. Choose Query > Select.

2. In the Select dialog box, click the Assist button.

3. In the Expression dialog box, type your expression directly into this box, or choose from the drop-down

list selections to create an expression.

4. Click Verify to verify that your expression is valid.

5. Click OK to return to the Select dialog box.

6. Click OK to run the expression.

The Expression dialog box gives you three drop-down lists that you can use to build your expression:
columns, operators, and functions.

Columns

This pop up lists every column in the table from which you are selecting. If the table contains derived
columns from previous queries, those columns will also be listed.

Operators

This pop up contains mathematical and logical operation symbols. The mathematical operators in this
pop up include addition, subtraction, multiplication, division, greater than, less than, and equal signs.
You can use these symbols to create mathematical formulas. For example, from your table of sales
representatives you want to select those sales representatives who, on the average, gross more than
$2000 per month. Gross sales is computed by adding together sales and commission.

You have two columns in your table: TOTAL_SALES, which is total sales for the year for each
representative and COMMISSION, which is total commission for the year for each representative. You
could build the following expression:

• (TOTAL_SALES + COMMISSION) / 12 < 2000

This expression tells MapInfo Professional to add the number in the TOTAL_SALES column with the
number in the COMMISSION column. However, this gives you gross sales for the year. We want average
gross sales for the month. Therefore, we divide the sum by 12, which will give us a monthly average.
We then compare that figure with 2000.

The Operators pop up also includes logical operators conjunctions AND, NOT, OR and LIKE. The LIKE
operator can be used with two wildcard characters: `%' and `_'. The `%' character matches zero or more
characters. The `_' character matches only one character.

Functions

This pop up contains mathematical functions that take one or more parameters and return a value. You
use functions to perform basic mathematical functions on the data in that column. For example:

• abs(<number>)

takes the absolute value of the numbers in the specified column.

For example, a meteorologist wants to select all days where the temperature in her city was more than
10 degrees warmer or cooler than the national average. She has a column in her table, AVG_DIFF, that
contains the difference between the national average and city average.

She could create the following expression:

• AVG_DIFF < -10 Or AVG_DIFF > 10

This expression tells MapInfo Professional to select all records that have an average difference less
than -10 or greater than +10. However, she could also create the following expression:

• abs(AVG_DIFF) > 10

This expression tells MapInfo Professional to select all records where the absolute value of the average
difference is greater than ten.

The Functions pop up contains many other functions, including area, perimeter, sin, cos, and date-related
functions. For a complete list of functions, see

Creating Expressions

.

237

MapInfo Professional User Guide

Chapter 9: Selecting and Querying Data

Advertising