Where clause - boolean expressions, Functions in expressions, Where clause – boolean expressions – Pitney Bowes MapXtreme User Manual

Page 209

Advertising
background image

Chapter 10: Creating Expressions

Where Clause – Boolean Expressions

MapXtreme v7.1

216

Developer Guide

Select colA, colB, colC from Table1, Table2
Select colA/2, ColB/ColC from Table1

You can also write expressions that perform mathematical operations on your data.

For example, RENT + UTILITIES is an expression that adds two columns together. This expression
could be used in a SQL statement to find all apartments that have a total cost of less than $800 per
month.

Where Clause – Boolean Expressions

A Boolean expression is a search condition that results in a value of either True or False. For
example, the expression

2 < 5

is a Boolean expression because the result is True.

All expressions that contain relational operators, such as the less than sign (<), are Boolean. The
operators AND, OR, and NOT, are Boolean operators. Boolean expressions are also called
comparison expressions, conditional expressions, and relational expressions.

POP_2000 > 500000
POP_2000 <= POP_1990
PROVINCE <> ‘Ontario’
County = ‘Columbia’ AND VALUE >= 250000

Supported operators in MapInfo SQL are defined in the MapInfo SQL Reference online via the
integrated Help in Visual Studio (look for MapInfo SQL Reference in the Dynamic Help contents
pane).

Boolean expressions are used in the “where clause” of an SQL statement. The where clause is the
expression that controls the rows that are returned (the rows that result in True).

For example, the boolean expression in this statement follows WHERE. Only objects in the Europe
table that fall within the boundary of France will be returned as True.

"SELECT * FROM Europe WHERE MI_Geometry within @France";

Functions In Expressions

Functions in MapXtreme are used to create even more complex expressions to retrieve data that
meets specific criteria. For example, MapInfo SQL supports many of the usual database functions
that work with strings, dates, and numbers. Beginning with MapXtreme 7.1, DateTime and Time
functions are also supported.

The most powerful functions in MapInfo SQL are those that take advantage of the spatial nature of
mapping data. These geographic functions are used to create new geometries, measure area and
length, return spatial information, validate spatial relationships among geometries, and others.
Supported functions are defined in the MapInfo SQL reference.

Advertising