Relational Database Concepts for Beginners



Similar documents
Accounts Payable Back Office Reference Guide

Explore architectural design and act as architects to create a floor plan of a redesigned classroom.

Three daily lessons. Year 5

Cambridge English: First (FCE) Writing Part 1

Creation. Then God spoke and Creation came into being. God formed everything: Creation Week God called all that He had created good.

Working with the Geodatabase Using SQL

Integers are positive and negative whole numbers, that is they are; {... 3, 2, 1,0,1,2,3...}. The dots mean they continue in that pattern.

QM0113 BASIC MATHEMATICS I (ADDITION, SUBTRACTION, MULTIPLICATION, AND DIVISION)

Section 1.5 Exponents, Square Roots, and the Order of Operations

Tutorial 6 GPS/Point Shapefile Creation

Federation and a CMDB

Class 3. Early Reading Assessment

Access Tutorial 2: Tables

Summer Reading Study Guide. Ray Bradbury s Fahrenheit 451

How to Make the Most of Excel Spreadsheets

Overview. Table of Contents. SA Data Warehouse

What is a database? The parts of an Access database


SEBA Solutions Inc Bellwind Circle Rockledge, Florida voice, fax

Data Doesn t Communicate Itself Using Visualization to Tell Better Stories

FREQUENTLY ASKED QUESTIONS (FAQs) Informed Visibility (IV) Internal Service Performance Measurement (SPM) Sampling

Setting up a basic database in Access 2003

Tutorial 4 - Attribute data in ArcGIS

EASY $65 PAYDAY FREE REPORT

Welcome to the topic on creating key performance indicators in SAP Business One, release 9.1 version for SAP HANA.

Q&As: Microsoft Excel 2013: Chapter 2

Why & How: Business Data Modelling. It should be a requirement of the job that business analysts document process AND data requirements

QUALITY TOOLBOX. Understanding Processes with Hierarchical Process Mapping. Robert B. Pojasek. Why Process Mapping?

File by OCR Manual. Updated December 9, 2008

Instructions How to use and send the PIT (Physician in Training) Permit Application Spreadsheet

What is Organizational Communication?

Decimal Notations for Fractions Number and Operations Fractions /4.NF

Years after US Student to Teacher Ratio

Chapter 3. Distribution Problems. 3.1 The idea of a distribution The twenty-fold way

Working with Geodatabase Topology

Dr. Lisa White

LESSON 12 ALL SAVINGS CHOICES INVOLVE RISK: GRANDMA S GIFT

Duplication Problem. Duplicating Columns

Teacher Development Pack Suggested Answers

Fractions Packet. Contents

Graphic Design: Introduction to Typography

2 SYSTEM DESCRIPTION TECHNIQUES

Client Marketing: Sets

Your Guide to E*TRADE s Platinum Independent Advisor Platform

Quantitative vs. Categorical Data: A Difference Worth Knowing Stephen Few April 2005

Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter 4 described a mathematical system

Data Visualization. Prepared by Francisco Olivera, Ph.D., Srikanth Koka Department of Civil Engineering Texas A&M University February 2004

Microsoft Get It Done Survey of Office Workers

This guide has been written to support reviewers in writing SMART objectives within the SRDS framework. These guidelines cover the following.

How to Concatenate Cells in Microsoft Access

Setting up a basic database in Access 2007

STEP 5: Giving Feedback

The Entity-Relationship Model

Decimal Fractions. Grades 6 and 7. Teacher Document. We acknowledge the valuable comments of Hanlie Murray and Sarie Smit

9. Momentum and Collisions in One Dimension*

Cookbook 23 September 2013 GIS Analysis Part 1 - A GIS is NOT a Map!

Aim To help students prepare for the Academic Reading component of the IELTS exam.

TRL Nook Simple Touch User guide

6.3 Conditional Probability and Independence

How is the Ascend insurance estimate calculated? Why doesn't my insurance estimate look right?

Toothpick Squares: An Introduction to Formulas

Top Ten Mistakes in the FCE Writing Paper (And How to Avoid Them) By Neil Harris

Session 7 Fractions and Decimals

Scan Physical Inventory

Tutorial Creating a regular grid for point sampling

INTEGRATED SKILLS TEACHER S NOTES

MD5-26 Stacking Blocks Pages

Assessment Management

CONSTRUCTING A COVER LETTER

Communication Process

Turtle Power. Introduction: Python. In this project, you ll learn how to use a turtle to draw awesome shapes and patterns. Activity Checklist

Sudoku puzzles and how to solve them

State of Illinois Web Content Management (WCM) Guide For SharePoint 2010 Content Editors. 11/6/2014 State of Illinois Bill Seagle

Key #1 - Walk into twenty businesses per day.

A Little Set Theory (Never Hurt Anybody)

Linear Referencing Tutorial

Implementation of Best Practices in Environmental Cleaning using LEAN Methodology. Tom Clancey and Amanda Bjorn

Changes to AdWords Reporting A Comprehensive Guide

Independent samples t-test. Dr. Tom Pierce Radford University

Mutual Fund Expense Information on Quarterly Shareholder Statements

think customer service in the U.S. is the worst it s ever been. And, because in

TEACHER S GUIDE TO RUSH HOUR

Welcome to GAMS 1. Jesper Jensen TECA TRAINING ApS This version: September 2006

Activity 10 - Universal Time

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

Poverty among ethnic groups

Understanding Raster Data

Writing Thesis Defense Papers

6. LECTURE 6. Objectives

Binary Numbers Kristin Labby

Placement Test English (A1, A2, B1)

OA3-10 Patterns in Addition Tables

Grantium guidance for applicants How to create and manage your user account and applicant profile. Version 1 January 2016

MOTOR CARRIER SERVICES MoDOT Carrier Express 24-Hour Online System

Even Cowboys Need Good Data City of Pendleton GIS Development

Welcome to the topic on managing delivery issues with Goods Receipt POs.

Obesity in America: A Growing Trend

Workplace Color Coding Standards

UCC Writing Survey of Students

Transcription:

Relational Database Concepts for Beginners A database contains one or more tables of information. The rows in a table are called records and the columns in a table are called fields or attributes. A database that contains only one table is called a flat database. A database that contains two or more related tables is called a relational database. There are other more complex kinds of databases, but this paper is going to focus on the what and why of relational databases. Here s an easy way to understand the benefits of dividing your data into multiple tables: Imagine that you are responsible for keeping track of all the books being checked out of a library. You could use a single table (a flat database) to track all the critical information: First Name Last Name Address Phone Book Title Due Date Bob Smith 123 Main St. 555-1212 Don Quixote 7-14-09 This table meets the basic need to keep track of who has checked out which book, but does have some serious flaws in terms of efficiency, space required, and maintenance time. For example, as voracious reader Bob checks out more books over time, you will have to re-enter all of his contact information for every book. First Name Last Name Address Phone Book Title Due Date Bob Smith 123 Main St. 555-1212 Don Quixote 7-14-09 Alicia Petersohn 136 Oak St. 555-1234 Three Men in 7-16-09 a Boat Bob Smith 123 Main St. 555-1212 Things Fall 8-15-09 Apart Bob Smith 123 Main St. 555-1212 Anna 8-15-09 Karenina Zayn Murray 248 Pine Dr. 555-1248 Heidi 8-17-09 Bob Smith 123 Main St. 555-1212 The Old Man and the Sea 9-10-09 To re-enter Bob s contact information wastes time, and increases the opportunity for error. Moreover, when an update is necessary (e.g. Bob s phone number changes), each of Bob s records must be located and corrected. If one of Bob s records has a different phone number from the rest, is it a correction, a record overlooked during the last update, or a data-entry mistake? 1

These problems can be decreased by normalizing our data in other words, dividing the information into multiple tables with the goal of having a place for everything, and everything in its place. Each piece of information should appear just once, simplifying data maintenance and decreasing the storage space required. PATRONS TABLE First Name Last Name Address Phone Bob Smith 123 Main St. 555-1212 Alicia Petersohn 136 Oak St. 555-1234 Zayn Murray 248 Pine Dr. 555-1248 CHECKOUT TABLE Book Title Due Date Don Quixote 7-14-09 Three Men in 7-16-09 a Boat Things Fall 8-15-09 Apart Anna 8-15-09 Karenina Heidi 8-17-09 The Old Man 9-10-09 and the Sea Now that the data are arranged efficiently, we need a way to show which records in the PATRONS table correspond to which records in the CHECKOUT table in other words, who checked out which book. Instead of repeating everything we know about a patron whenever he checks out a book, we will instead give each library patron an ID, and repeat only the ID whenever we want to associate that person with a record in a different table. PATRONS TABLE Patron ID First Name Last Name Address Phone 1 Bob Smith 123 Main St. 555-1212 2 Alicia Petersohn 136 Oak St. 555-1234 3 Zayn Murray 248 Pine Dr. 555-1248 CHECKOUT TABLE Patron ID Book Title Due Date 1 Don Quixote 7-14-09 2 Three Men in a Boat 7-16-09 1 Things Fall Apart 8-15-09 1 Anna Karenina 8-15-09 3 Heidi 8-17-09 1 The Old Man and the Sea 9-10-09 2

Now the PATRONS and CHECKOUT tables can be related (how relationships are formally declared in various database software is beyond the scope of this paper). At this point, we need some new terms to talk about our related tables. The primary key is a field whose values are unique in this table, and so can be used as identifiers for the records (multi-field or composite primary keys are beyond the scope of this paper, and are unlikely in an ArcGIS geodatabase). In table PATRONS, the Patron ID field is the primary key and so its values must remain unique. For example, the value 2 can appear only on one record - Alicia s - and Alicia can have only one Patron ID - 2. Is the Patron ID field in table CHECKOUT the primary key? We can see that it contains duplicate values, so the answer is No. If Patron ID were the primary key for CHECKOUT, each person would only be permitted to check out one book, and afterward would be forbidden to check out any more books, ever. So if Patron ID is not the primary key for table CHECKOUT, which field is? We can t make Book Title the primary key, or we d have a similar problem each book could only be checked out once, and afterward no one would be permitted to check it out ever again. We can t make Due Date the primary key, or else only one book could be due each day. Since none of the existing fields works as a primary key, we will add a new field to hold an identifier for each record. We could name this field Checkout ID, or we could follow ESRI s convention of giving all primary key fields exactly the same name: ObjectID. PATRONS TABLE ObjectID First Name Last Name Address Phone 1 Bob Smith 123 Main St. 555-1212 2 Alicia Petersohn 136 Oak St. 555-1234 3 Zayn Murray 248 Pine Dr. 555-1248 CHECKOUT TABLE ObjectID Patron ObjectID Book Title Due Date 1 1 Don Quixote 7-14-09 2 2 Three Men in a Boat 7-16-09 3 1 Things Fall Apart 8-15-09 4 1 Anna Karenina 8-15-09 5 3 Heidi 8-17-09 6 1 The Old Man and the Sea 9-10-09 3

Naming every primary key field ObjectID does make it easy to tell at a glance which field uniquely identifies the records in this table. We can also use this naming convention to provide hints about which fields are related. For example, Patron ObjectID in CHECKOUT is related to ObjectID in PATRONS. To further increase efficiency, decrease required space, and improve ease of maintenance, we can separate the book information into its own table. PATRONS TABLE ObjectID First Name Last Name Address Phone 1 Bob Smith 123 Main St. 555-1212 2 Alicia Petersohn 136 Oak St. 555-1234 3 Zayn Murray 248 Pine Dr. 555-1248 CHECKOUT TABLE ObjectID Patron ObjectID Book ObjectID Due Date 1 1 1 7-14-09 2 2 6 7-16-09 3 1 3 8-15-09 4 1 5 8-15-09 5 3 2 8-17-09 6 1 4 9-10-09 BOOKS TABLE ObjectID Title Author Year 1 Don Quixote Miguel Cervantes 1605 2 Heidi Johanna Spyri 1880 3 Things Fall Apart Chinua Achebe 1958 4 The Old Man and the Earnest 1952 Sea Hemingway 5 Anna Karenina Leo Tolstoy 1873 6 Three Men in a Boat Jerome K. Jerome 1889 Now ObjectID in BOOKS is related to Book ObjectID in CHECKOUT. When two tables have an unequal relationship, we call the independent table the parent and the dependent table the child. You can identify the parent table by determining which table could contain a record without needing a corresponding record in the table on the other side of the relationship. For example, is it possible to have an unpopular library book which never gets checked out? Yes. Is it possible to check out a book that doesn t exist? No. Since BOOKS can contain 4

records that aren t referenced by CHECKOUT, BOOKS is the parent in this relationship, and CHECKOUT is the child. If somehow the child table contains a record that does not have a corresponding record in the parent table, that record is called an orphan. Orphaned records are a problem that generally requires attention from the database administrator. Another way to identify the child table is to find the field which refers to the other table s ObjectID. BOOKS does not contain an ObjectID field for the CHECKOUTS, but CHECKOUTS does contain a field to store Book ObjectIDs. Therefore, CHECKOUTS is the child table in this relationship. The last new concept to consider is cardinality, which describes how many records in one table can be related to records in another table. Two tables might have a cardinality of 1-1 (one to one), 1- (one to many), 1-3 (one to three), - (many to many), etc. The PATRONS CHECKOUT relationship has a 1- cardinality, because 1 patron may have any number of checkouts, from zero to infinity. Put another way, the CHECKOUT PATRONS relationship has a cardinality of - 1. If the cardinality of PATRONS CHECKOUT were 1-1, then each patron could check out only one book. If it were -, then several patrons together might share joint responsibility for one or more checkouts. The BOOKS CHECKOUT relationship is also 1 -, since one book may be checked out multiple times. If we really were designing the data model (tables, fields, relationships, etc.) for a library, we would continue by separating even more data (such as the authors) into other tables until the model was as efficient as possible. Since we are modeling utility data instead, let s see how these ideas apply to meters and service points: SERVICE POINT TABLE ObjectID Shape Type Installation Date 1 <Shape> Single Residence 2-4-1974 2 <Shape> Multi-family 3-1-1980 3 <Shape> Single Residence 2-12-1998 METER TABLE ObjectID Address Service Point Object ID Status 1 123 Main St. 1 Active 2 136 Oak St. #3 2 Active 3 136 Oak St. #4 2 Inactive 4 248 Pine Dr. 3 Active 5 136 Oak St. #2 2 Active 6 136 Oak St. #1 2 Active 5

The SERVICE POINT table stores one record per location, but each location could have multiple Meters (for example, all the meters for an apartment building may be accessible from the same closet). The relationship between SERVICE POINT and METER is 1- (one Service Point can include any number of meters). METER is the child table, because it contains a field to store Service Point ObjectIDs. Also notice that SERVICE POINT contains a Shape field, but METER does not. ArcGIS stores a map feature s dimensions and location in the Shape field (although the specifics of this information may be hidden under the generic alias <Shape> ). The presence of a Shape field in the SERVICE POINT table tells us that Service Points are features objects that can be displayed on a map. The absence of a Shape field in METER tells us that Meters are ordinary objects that cannot be displayed on a map. When several related objects are likely to be in close proximity, having a Shape field only at the parent level decreases map clutter. For example, a high-rise apartment building might have one Service Point and 80 Meters. It is much more efficient to sketch one Service Point and then create 80 unmapped Meters related to that Service Point, than to sketch 80 individual Meters. In the same way, when sketching a three phase transformer, it is usually better to sketch one parent Transformer, which relates to three child Transformer Units (one per phase). TRANSFORMER UNIT TABLE ObjectID Phase Transformer ObjectID 1 A 1 2 B 1 3 C 1 4 B 2 6 B 3 7 C 3 TRANSFORMER TABLE ObjectID Pole LocationID Type 1 SE14323 3-Phase Overhead 2 2 1-Phase Overhead 3 SE14355 2-Phase Overhead 6

How does all this look in ArcFM and ArcMap? The green triangle shown here is one way a three-phase overhead Transformer might be symbolized on the map (this Transformer is on a 35-foot class 3 Pole with an Anchor Guy). Although only one symbol appears on the map, if we select this Transformer we can see that it is related to three Transformer Units one for each phase. We can also see that the Transformer has attributes, and each of the Transformer Units has its own attributes. The Transformer has a Shape field where its geographic location is stored. The Transformer Units do not have a Shape field, so we know they cannot appear on the map. A list of all related tables (both parents and children) appears below the feature. Thus we can see that Transformers can be related not only to Transformer Units, but also Electric Stations, Load Tap Changers, and so on. Whenever a record related to the selected feature exists in one of these tables, an expandable plus/minus box appears to the left. Since Transformer Unit is the only line with a plus/minus box, we know that this particular Transformer currently has related records only in the Transformer Unit table. 7

The small white box shown here is one way a Service Point might be symbolized on the map. This single Service Point includes twenty Meters one for each unit in this apartment building. Since only the Service Point has a Shape field, only it can be shown on the map. The Meter records store all the information we need to track for each customer, but cannot appear on the map. And now you know the fundamental database concepts of primary keys, parents, children, cardinality, and relationships, and their application to utility ArcGIS databases. 8