Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2006 by Maribeth H. Price 5-1 Chapter 5 Working with Tables.

Similar presentations


Presentation on theme: "Copyright © 2006 by Maribeth H. Price 5-1 Chapter 5 Working with Tables."— Presentation transcript:

1 Copyright © 2006 by Maribeth H. Price 5-1 Chapter 5 Working with Tables

2 Copyright © 2006 by Maribeth H. Price 5-2 Outline Knowing types and structure of tables Managing table files Modifying appearance of tables and fields Editing fields and calculating new values Selecting records by queries Creating summary statistics for table fields Understanding cardinality in table relationships Creating joins and relates between tables

3 Copyright © 2006 by Maribeth H. Price 5-3 Tables Tables contain attribute data Many formats, one interface

4 Copyright © 2006 by Maribeth H. Price 5-4 Types of tables Attribute table –Stores attributes of map features –Associated with a spatial data layer –Has special fields for spatial information Standalone table –Stores any tabular data –Not associated with spatial data –OID instead of FID

5 Copyright © 2006 by Maribeth H. Price 5-5 Sources of tables Dbase files INFO files ASCII Text files (tab or comma delimited) –Excel csv files Records from SQL database systems

6 Copyright © 2006 by Maribeth H. Price 5-6 Parts of a table Title Field Right-click field name to get menu Records Status bar Options menu

7 Copyright © 2006 by Maribeth H. Price 5-7 Fields Fields have specific types available Must be defined before use Once defined, cannot be changed Naming rules –No more than 13 characters –Use only letters and numbers –Must start with a letter

8 Copyright © 2006 by Maribeth H. Price 5-8 Field types Geodatabases and shapefiles Short Integers stored as 2-byte binary numbers (value range from -32,000 to +32,000) 255 1201 Long Integers stored as 4-byte binary numbers (value range from -2 billion to +2 billion) 156000 Float Floating point values with 8 significant digits in the mantissa 1.2893851e12 Double Double-precision floating point values with 16 significant digits in the mantissa 1.1111111111111 11e13 Text Alphanumeric strings‘Maple St’ Date Date format07/12/92 BLOB Binary large object; any complex binary data including images, documents, etc.

9 Copyright © 2006 by Maribeth H. Price 5-9 Field characteristics Length –The total characters a text field can store Precision –The total width of digits a numeric field can store Scale –The number of decimal places Length = 10 Maple St. Maple Stre 156 1985.128 -1922.5600 0.001 0.00001

10 Copyright © 2006 by Maribeth H. Price 5-10 Adjusting field width Temporary, does not affect stored file Hover over field break to get double arrow, then drag

11 Copyright © 2006 by Maribeth H. Price 5-11 Field properties tab Field alias Hide field

12 Copyright © 2006 by Maribeth H. Price 5-12 Shortcut to field properties

13 Copyright © 2006 by Maribeth H. Price 5-13 Formatting field display

14 Copyright © 2006 by Maribeth H. Price 5-14 Table appearance

15 Copyright © 2006 by Maribeth H. Price 5-15 Sorting tables Has no effect on original data

16 Copyright © 2006 by Maribeth H. Price 5-16 Selecting records

17 Copyright © 2006 by Maribeth H. Price 5-17 Show selected

18 Copyright © 2006 by Maribeth H. Price 5-18 Clear Selection On toolbar From table options menu From main menu

19 Copyright © 2006 by Maribeth H. Price 5-19 The Selection tab Right-click entry for context menu

20 Copyright © 2006 by Maribeth H. Price 5-20 Selection logic No selection –All features exported No selected features –No features exported Selected features –Only selected features exported Example: Exporting features to a new shapefile

21 Copyright © 2006 by Maribeth H. Price 5-21 Field statistics

22 Copyright © 2006 by Maribeth H. Price 5-22 Statistics Statistics for fields are based on the selected records

23 Copyright © 2006 by Maribeth H. Price 5-23 SQL Queries Some valid queries [POP1990] > 1000000 “STATE_NAME” = ‘Alabama’ [POP2000] >= [POP1990] Note: DBF tables have field names enclosed in quotes Geodatabase tables have field names enclosed in brackets

24 Copyright © 2006 by Maribeth H. Price 5-24 Multiple Criteria Queries Multiple criteria queries using AND or OR “STATE_NAME” = ‘Alabama’ OR “STATE_NAME” = ‘Texas’ –Note that the field name must be repeated for each condition

25 Copyright © 2006 by Maribeth H. Price 5-25 AND vs OR “Land-use” = ‘RES’ AND “Land-use” = ‘COM’ “Land-use” = ‘RES’ OR “Land-use” = ‘COM’ “Pop2000” ≥ 5000 OR “Pop2000” < 9000 “Pop2000” ≥ 5000 AND “Pop2000” < 9000 Wrong Right Remember—you test each feature separately

26 Copyright © 2006 by Maribeth H. Price 5-26 Multiple conditions Use parentheses to enforce order of evaluation (“LU” = ‘RES’ or “LU” = ‘COM’) and “Value” > 100000 “LU” = ‘RES’ or (“LU” = ‘COM’ and “Value” > 100000) $75,000 $125,000 $75,000 $125,000 $75,000 $125,000 $75,000 $125,000 RESCOM

27 Copyright © 2006 by Maribeth H. Price 5-27 The Like Operator “NAME” LIKE ‘%(D)%’ –Finds all of the (D) Democrats % is wildcard Ignores Don or Danforth “NAME” LIKE ‘%New %’ –Would find New Hampshire and New York, but not Newcastle or Kennewick

28 Copyright © 2006 by Maribeth H. Price 5-28 Adding a new field In ArcCatalog layer properties 4 3 1 5 2

29 Copyright © 2006 by Maribeth H. Price 5-29 Adding a field In ArcMap

30 Copyright © 2006 by Maribeth H. Price 5-30 Editing fields Open Editor toolbarStart editing Type edits in fields Save edits, stop editing

31 Copyright © 2006 by Maribeth H. Price 5-31 Calculating fields Add a new field if necessary Consider whether you need decimal places!

32 Copyright © 2006 by Maribeth H. Price 5-32 Calculate Right-click field to calculate Enter expression

33 Copyright © 2006 by Maribeth H. Price 5-33 Summarize My nomination for Most Useful Function! What is it? When to use it…

34 Copyright © 2006 by Maribeth H. Price 5-34 How many quakes in each state? Total deaths per state? Average magnitude per state?

35 Copyright © 2006 by Maribeth H. Price 5-35 Summarizing tables Calculate statistics for groups of features in a table Groups by unique values in the specified field User chooses statistics to calculate Produces another table as output with groups and stats How many earthquakes in each state? Total deaths and damage in each state? Average magnitude in each state? Historic major earthquakes

36 Copyright © 2006 by Maribeth H. Price 5-36 Example Group earthquakes by state field Determine total deaths, total damage, and average magnitude of earthquakes in each state.

37 Copyright © 2006 by Maribeth H. Price 5-37 How to summarize Right-click State field Sum Deaths Sum Damage Average Mag Average MMI

38 Copyright © 2006 by Maribeth H. Price 5-38 Summarize Output Table Count field always generated automatically

39 Copyright © 2006 by Maribeth H. Price 5-39 Create map Can we now create a map of deaths by state? Standalone table

40 Copyright © 2006 by Maribeth H. Price 5-40 Joining tables Summarize output table States layer attributes

41 Copyright © 2006 by Maribeth H. Price 5-41 US Earthquake Deaths by State Join summarize output to states layer to create map of deaths

42 Copyright © 2006 by Maribeth H. Price 5-42 Joining tables Join tables on common field Joined table Destination tableSource table

43 Copyright © 2006 by Maribeth H. Price 5-43 Join facts Joins are temporary relationships between tables Tables must share a common field Treats the two tables as a single table Original stored data is not affected Can be removed when no longer needed

44 Copyright © 2006 by Maribeth H. Price 5-44 One-to-one joins Each record in the destination table matches exactly one record in the source table. Destination table Source table We call this a cardinality of one-to-one.

45 Copyright © 2006 by Maribeth H. Price 5-45 Types of Cardinality One-to-one –States to Governors –Husbands to wives One-to-many –States to cities –Districts to schools Many to one –Cities to states –Schools to districts Many-to-many –Students to classes –Stores to customers

46 Copyright © 2006 by Maribeth H. Price 5-46 Relational databases RestaurantRes- ID Parcel_no Jake’s Pizza2045-98764 Momma’s Pie Hut3064-56790 Big Burger Barn4062-98754 Res-IDNameSSN 20Jake Smith134-56-7689 20Nancy Gold229-69-3490 20Dan Smurt345-34-8968 30Karen White776-67-4578 40Judy Lewis670-45-6890 40Joshua Jones675-56-4982 Parcel_noAddressValueOwner 45-987641104 Maple Ave67,000Roger Clark 64-567901900 Main St114,510Roger Clark 62-987549207 Sherry Ave59,000Judy Lewis Store distinct tables Establish relationships between them

47 Copyright © 2006 by Maribeth H. Price 5-47 Rule of Joining Each record in the destination table must match one and only one record in the source table. One to one Destination table Source table Many to one

48 Copyright © 2006 by Maribeth H. Price 5-48 One to many Destination table Source table ? Violates the Rule of Joining Record to join to destination is ambiguous Must use a relate instead

49 Copyright © 2006 by Maribeth H. Price 5-49 Relates Similar to a join except that –The tables remain separate –Items selected in one table may be highlighted in the related table

50 Copyright © 2006 by Maribeth H. Price 5-50 States Congressional Districts Related tables

51 Copyright © 2006 by Maribeth H. Price 5-51 How to join or relate tables


Download ppt "Copyright © 2006 by Maribeth H. Price 5-1 Chapter 5 Working with Tables."

Similar presentations


Ads by Google