Presentation is loading. Please wait.

Presentation is loading. Please wait.

©2007 by Austin Troy. All rights reserved Lecture 6 Important Database Concepts Introduction to GIS Lecture slides by Austin Troy, University of Vermont,

Similar presentations


Presentation on theme: "©2007 by Austin Troy. All rights reserved Lecture 6 Important Database Concepts Introduction to GIS Lecture slides by Austin Troy, University of Vermont,"— Presentation transcript:

1 ©2007 by Austin Troy. All rights reserved Lecture 6 Important Database Concepts Introduction to GIS Lecture slides by Austin Troy, University of Vermont, © 2007

2 ©2007 by Austin Troy. All rights reserved People use number system with base 10 Each digit corresponds to 10 to some power Why are computer values so often in multiples of eight? A byte is 8 “on-off switches” or bits Each switch/bit represents a binary number; one byte is 2 8 or 256 possibilities Introduction to GIS How is Data Stored?

3 ©2007 by Austin Troy. All rights reserved Switch combinations determine base ten number based on the formula: N 10 = 2 b-1 +2 b-2 +…2 b-b Where b= number of bits storing the number Hence the binary number 11111111 2 = 2 7 *1+ 2 6 *1 + 2 5 *1 + 2 4 *1 + 2 3 *1 + 2 2 *1 + 2 1 *1 + 2 0 *1 = 255 10 And the binary number 11111110 2 = 2 7 *1+ 2 6 *1 + 2 5 *1 + 2 4 *1 + 2 3 *1 + 2 2 *1 + 2 1 *1 + 2 0 *0 = 254 10 Introduction to GIS How do binary numbers translate to real numbers?

4 ©2007 by Austin Troy. All rights reserved Number of possible values for a unit of data is an exponential function of the number of switches 2 8 =256eight bit data 2 16 =65,536sixteen bit data 2 32 = 4,294,967,296thirty two bit data Introduction to GIS Number of Possible Values is fn of number of bits

5 ©2007 by Austin Troy. All rights reserved Number of bits determines data types Examples of Integer data types  Byte: 2 8 (0 to 255)  Short Integer: 2 16 (ranges from –32,767 to +32,767 without decimals, the sixteenth bit determines sign)  Long Integer: 2 32 (+/- 2.147483e+09 ) Floating point: precision can go to either side of decimal place  Single precision: 32 bit  Double precision: 64 bit Introduction to GIS

6 ©2007 by Austin Troy. All rights reserved  Currency Date (recognizes order in dates)  String (text)  When numbers are represented as text they have no numerical properties (e.g. zip codes)  Boolean (yes, no)  Object Introduction to GIS Other Data Types

7 ©2007 by Austin Troy. All rights reserved Three Classic Database Models Hierarchical Network Relational -Arc View and Arc Info use this model Introduction to GIS

8 ©2007 by Austin Troy. All rights reserved Hierarchical Database Model A one-to-many method for storing data in a database that looks like a family tree with one root and a number of branches or subdivisions. Problem: linkages in the tables must be known before Introduction to GIS Groovy 70s TV Action showsDrama Sitcoms Dukes of Hazzard CHIPs DallasFantasy Island Love Boat Starsky and Hutch Tom Wopat Eric Estrada Gavin McLeod Larry Wilcox Larry Hagman Ricardo Montalban David Soul Ted Lange

9 ©2007 by Austin Troy. All rights reserved Hierarchical Database Model Example where this model works well: plant and animal taxonomies Soil classification Works when: classes are totally mutually exclusive/ exhaustive Problem with this model: Does not work when have entities that belong to several classes or do not have mutual exclusivity Think about the problems with Windows Explorer Example: classifying your music collection Introduction to GIS

10 ©2007 by Austin Troy. All rights reserved Networked Database Model A database design for storing information by linking all records that are related with a list of “pointers.” Problem: linkages in the tables must be known before. Not adaptable to change. Introduction to GIS Action showsDrama Sitcoms Dukes of Hazzard CHIPs DallasFantasy Island Love Boat Three’s company ABC CBS NBC

11 ©2007 by Austin Troy. All rights reserved Relational (Tabular) Database Model A design used in database systems in which relationships are created between one or more flat files or tables based on the idea that each pair of tables has a field in common, or “key”. In a relational database, the records are generally different in each table The advantages: each table can be prepared and maintained separately, tables can remain separate until a query requires connecting, or relating them, relationships can be one to one, one to many or many to one Introduction to GIS

12 ©2007 by Austin Troy. All rights reserved Introduction to GIS NamePhoneAddressStudent ID *** Records are the unit that the data are specific to Fields, or columns, are attribute categories Cells are where individual values of a record for a field are stored Data Tables (flat files) records fields cells Headings: are the labels for the columns

13 ©2007 by Austin Troy. All rights reserved Introduction to GIS Course name Course number enrollmentfaculty ID *** Is a field that is common to two or more flat files; allows a query to be done across multiple tables or allows two tables to be joined Data key NamePhoneAddressfaculty ID *** Flat file: professor infoFlat file: course info

14 ©2007 by Austin Troy. All rights reserved Join Tables Based on the values of a field that can be found in both tables The name of the field does not have to be the same The data type has to be the same KeyA B 1 2 3 C 1 2 1 2 3 4 5 6 10 20 KeyA B 1 2 3 1 2 3 4 5 6 C 10 50 JOIN Introduction to GIS In this case we have a one to one join; here the key is unique 3 50

15 ©2007 by Austin Troy. All rights reserved Join Tables KeyA B 1 1 2 C 1 2 1 2 3 4 5 6 10 20 KeyA B 1 1 2 1 2 3 4 5 6 C 10 20 JOIN Introduction to GIS In this case we have a one to many join; here the key is not unique

16 ©2007 by Austin Troy. All rights reserved u Relational (Tabular) Database Model: 70s TV example Now we can have various flat files (tables) with different record types and with various attributes specific to each record Introduction to GIS ActorYear born* Sideburn length David Soul1948serious Eric Estrada1949moderate Larry Wilcox 1953slight Tom Wopat1950major ShowLead actor Co-starNetwork * Starsky and Hutch David Soul Paul Michael Glaser ABC CHIPsEric Estrada Larry WilcoxCBS DukesTom Wopat John Schneider NBC *entirely guessed at- I am not responsible for mistaken TV trivia Table 1- specific to actors Table 2- specific to shows

17 ©2007 by Austin Troy. All rights reserved u Relational (Tabular) Database Model This allows queries that go across tables, like which CBS lead actors were born before 1951? Answer: Tom Wopat and David Sole Introduction to GIS ActorYear born* Sideburn length David Sole1948serious Eric Estrada1949moderate Larry Wilcox 1953slight Tom Wopat1950major ShowLead actor Co-starNetwork * Starsky and Hutch David Soul Paul Michael Glaser CBS CHIPsEric Estrada Larry WilcoxABC DukesTom Wopat John Schneider CBS *entirely guessed at- I am not responsible for mistaken TV trivia It does this by combining information from the two tables, using common key fields

18 ©2007 by Austin Troy. All rights reserved u Relational (Tabular) Database Model Object-relational databases can contain other objects as well, like images, video clips, executable files, sounds, links Introduction to GIS ActorYear born* Sideburn length Picture David Soul1948serious Eric Estrada1949moderate Larry Wilcox 1953slight Tom Wopat1950major

19 ©2007 by Austin Troy. All rights reserved u Relational Database: another example: property lot info Introduction to GIS One-to-one relationship Parcel ID Street address zoning 11 15 Maple St. Residential-1 12 85 Brooks Ave Commercial-2 13 74 Windam Ct. Residential 4 OwnerParcel IDoccupation J. Smith 13lawyer R. Jones 11dentist T. Flores 12Real estate developer

20 ©2007 by Austin Troy. All rights reserved u Relational database: one to many relationship Introduction to GIS One-to-many relationship Parcel ID Street address zoning 11 15 Maple St. Residential-1 12 85 Brooks Ave Commercial-2 13 74 Windam Ct. Residential 4 OwnerParcel IDoccupation J. Smith 13lawyer R. Jones 11dentist J. McCann 12financier T. Flores 12Real estate developer In this case, several people co-own the same lot, so no longer one lot, one person

21 ©2007 by Austin Troy. All rights reserved Assuming each owner owned several parcels, we would structure the database differently Introduction to GIS One-to-many relationship Parcel ID Street address zoning 11 15 Maple St.Residential-1 12 85 Brooks AveCommercial-2 13 74 Windam Ct.Residential 4 Owneroccupation# properties owned J. Smith lawyer2 R. Jones dentist5 J. McCann financier2 T. Flores Real estate developer 3 Properties owned by T. Flores OwnerParcel ID Date of transaction Flores13 4-15-00 Flores15 4-17-01 Flores19 3-12-99 Note: this table includes data pertinent only to Flores’ ownership of these properties

22 ©2007 by Austin Troy. All rights reserved Example Here’s an example of a chart showing the relationships between flat files in a sample relational database for food suppliers* in Microsoft Access Introduction to GIS * This comes from an MS ACCESS sample database

23 ©2007 by Austin Troy. All rights reserved Introduction to GIS * This comes from an MS ACCESS sample database

24 ©2007 by Austin Troy. All rights reserved Introduction to GIS * This comes from an MS ACCESS sample database A real time RDBMS allows for realtime linking and embedding of tables based on common fields Here we see all the orders for product ID 3; there is no need to include product ID in that sub- table


Download ppt "©2007 by Austin Troy. All rights reserved Lecture 6 Important Database Concepts Introduction to GIS Lecture slides by Austin Troy, University of Vermont,"

Similar presentations


Ads by Google