MapInfo Tutorial Home
Section Four


Section Four: Advanced Features

Part One: Queries


Select tools

Queries

Query Select
  • Use Select Records from Table to choose the table containing the records you wish to select.
  • Use the box to the right of 'that Satisfy' to enter the criteria by which the records are to be selected. The Assist button provides help with this, construction an expression with drop down menus for columns in the table, mathematical operators, and functions.
  • For Store Results in Table, choose a name which is more self explanatory than the default, Selection, otherwise when you have done many queries all your tables will have similar names (Selection, Selection2, Selection3 etc) and it may become difficult to remember which is which.
  • Sort Results by Column allows you to choose which column, if any, you wish to sort the new table by. However, if there is no particular reason for doing this it is better to leave it as none, because it is then easier to see which records have been omitted from the old table by the query as the records in the new table will be in the same order.
  • It is useful to leave the Browse Results box checked to view the new table after the query.

Structured/Standard Query Language (SQL)


Query > SQL Select
SQL dialog
  • The SQL Select dialog box appears.
  • The first stage of our query is to get rid of the Shipping ward from the table. Use the drop down menu to select the table you wish to work with. The name of this table then appears in the 'From table...' text box, the second one down.
  • Click in the top textbox, 'Select Columns.' Use the drop down menu Columns to select the column which stores the zone ID, the column which stores the zone name, the column which stores the total population by ward, and the column which stores the white population by ward. The column headings appear in the textbox. These are the columns which will appear in the new table which meets the conditions of the query.
  • Hint Most queries are performed in stages, each of which eliminates certain records. Be sure to include all the columns in the first stage which you will need for subsequent stages.
  • Click in the third textbox down, 'Where condition:' Either using the Columns and Operators drop down menus, or by typing, create the following expression using the name you gave to the column representing total population: totalpersons > 0.
  • Choose a self explanatory name for the new table you will create, and type this into the 'into table called' textbox. Leave the 'Group by columns' and 'Order by columns' textboxes blank.
  • Click OK. A new table containing only the rows in the original table selected by the query will appear. Should you view the original table in a browser of map window, the selected wards will be highlighted. In the map view, this means all the wards will be highlighted, as the only ward excluded by this stage of the query is the Shipping ward which is not represented on the map.
  • With your new table as the active window, open the SQL dialog box again (Query > SQL Select). Set the table in the 'from tables' textbox to the name of the table you have just created. Select all four of the columns in that table in the top textbox by using the Columns drop down menu.
  • Click in the 'Where condition' textbox. Either using the drop down menus or by typing, enter the query ((white/totalpersons)*100) >= 90, using the column names you gave to those variables in your own table.
  • Give a sensible name to your new table, and leave the 'Group columns by' and 'Order columns by' textboxes blank. Click OK.
  • View the results. Observe the clustering of the highlighted areas on the map now. The highlighted areas are all but the urban areas of Bradford and Keighley.
  • The new tables created from queries can also be used to create maps (Window > New Map Window or Map > Create Thematic Map) or graphs (Window > New Graph Window).


On to Section Four, Part Two: Further Analysis



Section Four
MapInfo Tutorial Home