Lab 7: Attribute SQL- Query the database You have been asked to determine which parcel properties...
-
date post
21-Dec-2015 -
Category
Documents
-
view
217 -
download
0
Transcript of Lab 7: Attribute SQL- Query the database You have been asked to determine which parcel properties...
Lab 7: Attribute SQL- Query the database
You have been asked to determine which parcel properties have a marketvalue greater than $75,000. You have been asked to find these properties and display on a mapwithin your study area.
How will you find the properties & display on a map using MapInfo?
In this lesson, you will learn how to ask questions/ query the attributetable data using query menus to build SQL (structured query language).
You will also learn what a relational join is and how to perform a relational join.
To query data in MapInfo, use Query> Select for simple selections:In this example, we want to find Census blocks that have >= 100 persons
1 First select File> open table
23
4
5
67
10
2 Select Query> Select
3 Select table
4 Select assistto write query
5 Select the column “population”6 Select the operator “>=“7 Type the value “100”8 Verify the syntax9 Select Ok10 Select OK to find the answer (next Slide)
89
The Query > Select result in parcels with “population >= 100” displays as a browser and each block highlighted on the map.The query results can be saved as a new table, discarded, or
the syntax can be saved in a query template.
To query data in MapInfo, use Query> SQL Select for more complex selections.Shown below is the Query> SQL Select screen example from MapInfo with a brief description of the options.
Select File>Open> select table, select Query> SQL Select 1a Highlight From Tables box
1b Select table from tables pop up (table appears in From Tables box) 2a Move cursor to where Condition box; 2b Select column required from columns menu pop up & the column (totalpopulation) displays in the where condition window3 Select operator (=,>,<,*,/,etc) from Operators menu pop up (operator appears in where condition)4 Type the value in the where condition box (In this case- 25000)5 Select other options (Here we are sorting by field totalpopulation so select Order by columns, select the columns button and select the column to sort by6 Select Ok – The results of the query are displayed as records in a browser & highlighted on map (See results on next Slide)
1a
2a
5
1b2b
6
**
3
4
The results of the Query>SQL Select– cities where the total population is <= 25,000:
A browser called Query1 is created that meets the SQL conditions (48 cities) and a map showing the 48 cities are highlighted
Also, note that the cities are sorted in ascending (increasing) value by total population
A common relational join using Query> SQL Select in MapInfo:Join the parcel polygon file to the Auditor’s parcel characteristics table.
1. Open the tables that you wish join
2 Determine the fields that are a common link
Relational Join – MapInfo example (continued)
3
45
6
3 Select Query> SQL Select4 Select tables to join5 type where condition or choose from column button parcel.ppn choose operator button = from column button audattr.parcel6 Verify syntax7 Select OK8 Query runs: results in a browser and polygons highlighted that met requirements. Query 1 can then be saved to a new table.
7
8