80 likes | 171 Views
Lab 7: Attribute SQL- Query the database. You have been asked to determine which parcel properties have a market value greater than $75,000. You have been asked to find these properties and display on a map within your study area.
E N D
Lab 7: Attribute SQL- Query the database You have been asked to determine which parcel properties have a market value greater than $75,000. You have been asked to find these properties and display on a map within 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 attribute table 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 2 Select Query> Select 2 3 3 Select table 4 Select assist to write query 4 5 7 6 9 8 • 5 Select the column “population” • 6 Select the operator “>=“ • 7 Type the value “100” • 8 Verify the syntax • 9 Select Ok • 10 Select OK to find the answer (next Slide) 10
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> SQLSelect for more complex selections. Shown below is the Query> SQLSelect screen example from MapInfo with a brief description of the options. 1b * * 2b 1a 3 4 2a 5 6 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 window 3 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 by 6 Select Ok – The results of the query are displayed as records in a browser & highlighted on map (See results on next Slide)
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. • Open the tables that you wish join • 2 Determine the fields that are a common link
Relational Join – MapInfo example (continued) 3 Select Query> SQL Select 4 Select tables to join 5 type where condition or choose from column button parcel.ppn choose operator button = from column button audattr.parcel 6 Verify syntax 7 Select OK 8 Query runs: results in a browser and polygons highlighted that met requirements. Query 1 can then be saved to a new table. 3 4 5 6 7 8
You are now ready to begin MapInfo Exercise- Lab 7 • Attribute SQL. The main objectives are: • To ask questions or query the attribute table using: • Query> Select Menu (for simple questions) • Query> SQL Select Menu (complex questions) • Begin exercise- lab 7