SQL and SSQL IT4GIS Keith T. Weber, GISP GIS Director, ISU.

Slides:



Advertisements
Similar presentations
Introduction to IBM DB2 Keith T. Weber GIS Director- Idaho State University.
Advertisements

What is a Database By: Cristian Dubon.
From portions of Chapter 8, 9, 10, &11. Real world is complex. GIS is used model reality. The GIS models then enable us to ask questions of the data by.
GI Systems and Science January 30, Points to Cover  Recap of what we covered so far  A concept of database Database Management System (DBMS) 
ArcGIS Geodatabase Miles Logsdon Spatial Information Technologies, UW Garry Trudeau - Doonesbury.
Database Management: Getting Data Together Chapter 14.
Geographic Information Systems
What is Where? u Getting Started With Geographic Information Systems u Chapter 5.
Introduction to Database Management
Spatial SQL: A Query and Presentation Language Max J. Egenhofer (Presenter: Yi-Shin Chen)
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
Database Design Overview. 2 Database DBMS File Record Field Cardinality Keys Index Pointer Referential Integrity Normalization Data Definition Language.
Microsoft Access 2010 Chapter 7 Using SQL.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Intro. To GIS Lecture 4 Data: data storage, creation & editing
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Resources – MS Access Free Online Training Resources  Using an Access database to store and information (2 min)
10. Creating and Maintaining Geographic Databases.
Microsoft Access 2010 Chapter 7 Using SQL. Change the font or font size for SQL queries Create SQL queries Include fields in SQL queries Include simple.
Applied Cartography and Introduction to GIS GEOG 2017 EL
Component 4/Unit 6f Topic VI: Create simple querying statements for the database The SELECT statement Clauses Functions Joins Subqueries Data manipulation.
Chapter 7 Advanced SQL Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Introduction to ArcGIS for Environmental Scientists Module 2 – Fundamentals Chapter 7 – Queries.
8. Geographic Data Modeling. Outline Definitions Data models / modeling GIS data models – Topology.
Chapter 9 Joining Data from Multiple Tables
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
SQL access and working with ST_Geometry Functions
Using Special Operators (LIKE and IN)
Implementing the Theory dBase Operations in MS Access.
Introduction to GeoDatabase Lecture
Data Queries Selecting features in ArcMap Data queries  Important part of a GIS project Can be a part of your data preparation or final analysis  Data.
Database and Data File Management Oct 6/7/8, 2010 Fall 2010 | / Recitation 2.
Creating and Maintaining Geographic Databases. Outline Definitions Characteristics of DBMS Types of database Relational model SQL Spatial databases.
Query and Reasoning. Types of Queries Most GIS queries will select spatial features Query by Attribute (Select by Attribute) –Structured Query Language.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Nhóm thực hiện: nhóm 1 Nguyễn Ngọc Trường Trần Minh Khang Bùi Quốc Huy Nguyễn Ngọc Linh Nguyễn Thành Phương Trần.
NR 143 Study Overview: part 1 By Austin Troy University of Vermont Using GIS-- Introduction to GIS.
Intro to GIS | Summer 2012 Attribute Tables – Part 1.
Benjamin Post Cole Kelleher.  Availability  Data must maintain a specified level of availability to the users  Performance  Database requests must.
School of Geography FACULTY OF ENVIRONMENT Querying with ArcGIS.
CMPT 258 Database Systems Relational Algebra (Chapter 4)
Oracle11g: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
DATA Spatial Data – where things are Non Spatial Data or Attribute Data – What things are Data in a computer database are managed and accessed through.
Lecture 10 Creating and Maintaining Geographic Databases Longley et al., Ch. 10, through section 10.4.
NSF DUE ; Wen M. Andrews J. Sargeant Reynolds Community College Richmond, Virginia.
Selecting features in ArcMap
CENTENNIAL COLLEGE SCHOOL OF ENGINEERING & APPLIED SCIENCE VS 361 Introduction to GIS SPATIAL OPERATIONS COURSE NOTES 1.
Create Views Using a Graphical Designer Database Administration Fundamentals LESSON 2.3b.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Lecture 3: Spatial Data Management Dr. Taysir Hassan Abdel Hamid Associate Professor, Information Systems Dept., Faculty of Computers and Information.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Lesson 3 GIS Fundamentals MEASURE Evaluation PHFI Training of Trainers May 2011.
Overlay Operations. Overlay Operations involve combining spatial and attribute data from two or more spatial data layers. “Stacking data” – Very powerful.
CHAPTER 10 DATA EXPLORATION 10.1 Data Exploration Box 10.1 Data Visualization Descriptive Statistics Box 10.2 Descriptive Statistics Graphs.
Key Terms Attribute join Target table Join table Spatial join.
Advanced Accounting Information Systems
GIS Institute Center for Geographic Analysis
9. Creating and Maintaining Geographic Databases
Geographic Information Systems
Structured Query Language (SQL) William Klingelsmith
Normalization Referential Integrity
Database.
GTECH 709 Week 2 summary.
ISU-GIS Training and Research Center
GIS Institute Center for Geographic Analysis
Handling Data in PL/SQL Blocks
GIS Institute Center for Geographic Analysis
Presentation transcript:

SQL and SSQL IT4GIS Keith T. Weber, GISP GIS Director, ISU

DefinitionsDefinitions SQL = Structured Query Language SSQL = Spatial SQL GPL = Graphical Presentation Language

SQL- A Review SQL is a simple language used to query (question) an ODBC-compliant database and retrieve data. SQL is not simple or standard S = structured

StructureStructure The most basic SQL statement is: –SELECT * from database.table Let’s dissect this statement –SELECT is the command –* is a wildcard = everything and anything –Database.table is the target of the query

A Little More… The previous SQL statement selected everything from a table How do we select only a portion of a table? –The WHERE CLAUSE

WHERE CLAUSE WHERE conditional operator For example: –SELECT * from database.table WHERE CITY_NAME = ‘Pocatello’

Types of Conditional Ops Simple (as in the previous example) Compound –Let’s say we want to select and work with the records describing Pocatello and Blackfoot We could select and work with them individually using two simple conditional operators…OR…

Combining Conditional Operator Expressions Instead of: –SELECT * from database.table WHERE CITY_NAME = ‘Pocatello’ –…do some work, and then –SELECT * from database.table WHERE CITY_NAME = ‘Blackfoot’ –…do some more work

We Can Use… A Compound expression combining two or more single expressions using either: –AND –OR In our example, which shall we use?

OROR SELECT * from database.table WHERE CITY_NAME = ‘Pocatello’ OR CITY_NAME = ‘Blackfoot’

Why OR? Before a record (entity) is returned as a result of a query, the record must satisfy EACH WHERE clause if AND is used. When OR is used, a record must satisfy only one of the WHERE clauses.

This is SQL What is SSQL? –Spatial Structured Query Language –Or SQL for Spatially enabled relational databases Informix Oracle IBM DB2 MS SQL Server

An Example SELECT residence.geometry FROM residence WHERE Type = ‘single family’ What is different about this expression? residence.geometry

Why is *.geometry important? Until now, we have been returning all fields (SELECT * FROM…) Now, we only want to see the geographic feature(s) returned by the query To do that, we instruct SSQL to select the geometry (.geometry) of the TABLE of interest (residence)

GIS Layers are Tables? Data type for Geometry Spatial Grid Extent

Object Relational OBJECTID inherited from Object class SHAPE inherited from a class called Feature This could be “Boundary”

SSQL with Topology Similar to intersect and union These are conditional operators that are written into the WHERE clause

Key Concepts SQL is highly structured Spatial SQL builds upon SQL but remains within the general framework SSQL requires an object relational, spatially enabled database The *.geometry table is queried to return features –which are stored in the table as a LOB field –Along with other topological attributes

Questions?Questions? Your assignment is: –Review basic SQL (if you feel it necessary) –Read Egenhofer’s early (1994) manuscript on Spatial SQL theory –Read the Spatial Data Extender white paper –Review the ArcGIS SSQL Help (use the link) –Complete the IBM DB2 SSQL exercise