Aspatial Selection Table Queries Table queries are a
Aspatial Selection
Table Queries • Table queries are a very common GIS aspatial operation • Selects a subset of records based on values of specific attributes • Uses Set Algebra and Boolean Operators
Set Algebra
Set Algebra • Set Algebra uses operations: – Less than* < – Greater than* > – Equal to* = – Not equal to < > • Greater Than and Less Than may not be applied to nominal attributes. – Why? *May be applied alone or in combination
“Male Population” > “Female Population” “Region” <> ‘Mountain’ “Population” > 7, 000 “State Name” = ‘South Dakota’
Boolean Algebra
Boolean Algebra • Uses conditions OR, AND, and NOT • Evaluated by assigning an outcome, true or false, to each condition • Order of operations do matter • Boolean operators are not distributable
Truth Tables X R T F F T NOT X F T Y F F T T AND R F F F T X F T Y F F T T OR Order of Operations: Parenthesis/Brackets -> NOT -> AND -> OR R F T T T
What are the results? NOT (F) T AND T F OR NOT(T) T OR (F OR (T AND T) ( T AND T) OR F AND (NOT(F) AND T )
What are the results? NOT (F) True T AND T True F OR NOT(T) False T OR (F OR (T AND T)) True ( T AND T) OR F AND (NOT(F) AND T ) True
Country Population 2009 Unemployment (%) UN Member Gyruss 67, 837 2. 1 N Pengo 5, 250, 275 8. 5 Y Galaxian 30, 167 3. 1 Y Tempest 2, 461, 267 19 N Zaxxon 14, 019 90 Y (UN Member = “Y” OR UN Member = “N”) AND Unemployment > 3. 5 Note: Data is fictitious
Country Population 2009 Unemployment (%) UN Member Gyruss 67, 837 2. 1 N Pengo 5, 250, 275 8. 5 Y Galaxian 30, 167 3. 1 Y Tempest 2, 461, 267 19 N Zaxxon 14, 019 90 Y (UN Member = “Y” OR UN Member = “N”) AND Unemployment > 3. 5 Answer: Pengo, Tempest, Zaxxon Note: Data is fictitious
Country Population 2009 Unemployment (%) UN Member Gyruss 67, 837 2. 1 N Pengo 5, 250, 275 8. 5 Y Galaxian 30, 167 3. 1 Y Tempest 2, 461, 267 19 N Zaxxon 14, 019 90 Y Population > 80, 000 AND Unemployment < 6 Note: Data is fictitious
Country Population 2009 Unemployment (%) UN Member Gyruss 67, 837 2. 1 N Pengo 5, 250, 275 8. 5 Y Galaxian 30, 167 3. 1 Y Tempest 2, 461, 267 19 N Zaxxon 14, 019 90 Y Population > 80, 000 AND Unemployment < 6 Answer: NULL (nothing was selected) Note: Data is fictitious
Country Population 2009 Unemployment (%) UN Member Gyruss 67, 837 2. 1 N Pengo 5, 250, 275 8. 5 Y Galaxian 30, 167 3. 1 Y Tempest 2, 461, 267 19 N Zaxxon 14, 019 90 Y NOT(Population < 1, 000 AND Population > 31, 000) AND UN Member = “Y” Note: Data is fictitious
Country Population 2009 Unemployment (%) UN Member Gyruss 67, 837 2. 1 N Pengo 5, 250, 275 8. 5 Y Galaxian 30, 167 3. 1 Y Tempest 2, 461, 267 19 N Zaxxon 14, 019 90 Y NOT(Population < 1, 000 AND Population > 31, 000) AND UN Member = “Y” Answer: Pengo, Zaxxon, Galaxian Note: Data is fictitious
- Slides: 17