Shaowen Wang CyberInfrastructure and Geospatial Information Laboratory (CIGI) Department of Geography and National Center for Supercomputing Applications.

Slides:



Advertisements
Similar presentations
Introduction to Databases
Advertisements

SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Oct 31, 2000Database Management -- Fall R. Larson Database Management: Introduction to Terms and Concepts University of California, Berkeley School.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 2 Introduction to Database Development.
Database Management: Getting Data Together Chapter 14.
Chapter 2 Database Environment. Agenda Three-Level ANSI-SPARC Architecture Database Languages Data Models Functions of DBMS Components of DBMS Teleprocessing.
Geographic Information Systems
Chapter 11 Data Management Layer Design
5 Chapter 5 Structured Query Language (SQL1) Revision.
“DOK 322 DBMS” Y.T. Database Design Hacettepe University Department of Information Management DOK 322: Database Management Systems.
CSC 2720 Building Web Applications Database and SQL.
Fundamental database concepts
RIZWAN REHMAN, CCS, DU. Advantages of ORDBMSs  The main advantages of extending the relational data model come from reuse and sharing.  Reuse comes.
Introduction and Conceptual Modeling
Chapter 4 Database Management Systems. Chapter 4Slide 2 What is a Database Management System (DBMS)?  Database An organized collection of related data.
Data at the Core of the Enterprise. Objectives  Define of database systems  Introduce data modeling and SQL  Discuss emerging requirements of database.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Chapter 2 Introduction to Database Development Database Processing David M. Kroenke © 2000 Prentice Hall.
Chapter One Overview of Database Objectives: -Introduction -DBMS architecture -Definitions -Data models -DB lifecycle.
IST Databases and DBMSs Todd S. Bacastow January 2005.
What is a Database? A database is any collection of data.
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
Chapter 9 SQL and RDBMS Part C. SQL Copyright 2005 Radian Publishing Co.
Data at the Core of the Enterprise. Objectives  Define of database systems.  Introduce data modeling and SQL.  Discuss emerging requirements of database.
Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 13 Database Management Systems: Getting Data Together.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Chapter 2 Database Environment
Introduction to SQL Steve Perry
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 2 This material was developed by Oregon Health & Science.
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
Database Fred Durao What is a database? A database is any organized collection of data. Some examples of databases you may encounter in.
Database Management Systems Introduction. In the Beginning… Customer Program 1.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
Chapter 2 Database Environment. Agenda Three-Level ANSI-SPARC Architecture Database Languages Data Models Functions of DBMS Components of DBMS Data Dictionary.
1 Chapter 1 Introduction. 2 Introduction n Definition A database management system (DBMS) is a general-purpose software system that facilitates the process.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Relational Database. Database Management System (DBMS)
Database Design Methodology. Lesson 1: Introduction to Databases.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Creating and Maintaining Geographic Databases. Outline Definitions Characteristics of DBMS Types of database Relational model SQL Spatial databases.
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
CS453: Databases and State in Web Applications (Part 2) Prof. Tom Horton.
Benjamin Post Cole Kelleher.  Availability  Data must maintain a specified level of availability to the users  Performance  Database requests must.
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
Information Systems Today: Managing in the Digital World TB3-1 3 Technology Briefing Database Management “Modern organizations are said to be drowning.
Lecture 10 Creating and Maintaining Geographic Databases Longley et al., Ch. 10, through section 10.4.
What is MySQL? MySQL is a relational database management system (RDBMS) based on SQL (Structured Query Language). First released in January, Many.
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
CP476 Internet Computing Perl CGI and MySql 1 Relational Databases –A database is a collection of data organized to allow relatively easy access for retrievals,
Chapter 3: Relational Databases
Database Environment Chapter 2. The Three-Level ANSI-SPARC Architecture External Level Conceptual Level Internal Level Physical Data.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Faeez, Franz & Syamim.   Database – collection of persistent data  Database Management System (DBMS) – software system that supports creation, population,
uses of DB systems DB environment DB structure Codd’s rules current common RDBMs implementations.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
Data Resource Management Data Concepts Database Management Types of Databases Chapter 5 McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies,
Principles of GIS Fundamental database concepts – II Shaowen Wang
CS1222 Using Relational Databases and SQL
Principles of GIS Fundamental database concepts Shaowen Wang
CS1222 Using Relational Databases and SQL
Data Model.
CS1222 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
Presentation transcript:

Shaowen Wang CyberInfrastructure and Geospatial Information Laboratory (CIGI) Department of Geography and National Center for Supercomputing Applications (NCSA) University of Illinois at Urbana-Champaign January - February, 2011 Principles of GIS Fundamental database concepts

2 Database Characteristics Reliability Reliability Integrity Integrity Security Security Concurrency Concurrency Data dependence Data dependence Distributed access Distributed access Interface Interface Self-describing Self-describing

3 Database Applications Business Business Engineering Engineering Medicine Medicine Government Government Etc. Etc.

4 DBMS User interface and query language User interface and query language Query compiler and optimizer Query compiler and optimizer Constraint enforcer Constraint enforcer Runtime database processor Runtime database processor Stored data manager Stored data manager System catalog System catalog –Metadata

5 Metadata Data about data Data about data XML (eXtensible Markup Language) XML (eXtensible Markup Language) GML GML –

6 Database Transaction Insert Insert Modify Modify Delete Delete Retrieve Retrieve

7 Transaction Support Concurrency Concurrency –Interleaving –Lost update Recovery control Recovery control –Atomicity –Independence DBMS operations DBMS operations –Commit –Rollback

8 Database Models Relational Relational Object-oriented Object-oriented Conceptual model Conceptual model –Designers –Machines –Users

9 Entity-relationship model (E-R) Entity Entity –Type –Instance –Identifier Relationship Relationship –One-to-one –One-to-many –Many-to-many

10 Structured Query Language (SQL) Domain creation Domain creation Relation scheme creation Relation scheme creation Data manipulation Data manipulation –Data retrieval

Connecting to DB % ssh % ssh –Enter password Login to DB Login to DB –% psql -U username -d database_name –Help: %psql --help

Some Postgres Commands List all accessible databases List all accessible databases –# \l Connect to a DB named 'tutorial' Connect to a DB named 'tutorial' –# \c tutorial List all the tables in current DB List all the tables in current DB –# \dt, # \d (show all relations)‏ Quit Quit –# \q

SQL Commands Create DB Create DB –CREATE DATABASE dbname OWNER rolename; –E.g. # create database tutorial;

SQL Commands Create Tables Create Tables –# create table test(key int, attr varchar(20), value float); Delete table Delete table –# drop table test;

SQL Commands Insert a row Insert a row –# insert into test values(1, 'attr0', 100); Update table contents Update table contents –# update test set attr='attr1' where key=1; Delete rows Delete rows –# delete from test where key=1;

SQL Commands List contents of table List contents of table –# select * from test; –# select * from test where attr='attr1';

Documentation Postgres Postgres – ive/index.html – ive/sql-commands.html An SQL Tutorial An SQL Tutorial –

18 Extended Entity- Relationship Model Sub-type Sub-type –Specialization Super-type Super-type –Generalization Inheritance Inheritance

19 Object-Orientation Object Object –State –Behavior Class Class –Attributes –Method

20 O-O Features Encapsulation Encapsulation –Reduces modeling complexity –Promotes reuse Inheritance and polymorphism Inheritance and polymorphism –Combats impedance mismatch –Metaphorical power

21 Relational Databases Attribute Attribute Tuple Tuple Relation scheme Relation scheme Relation Relation

22 Relation ID Candidate key Candidate key Primary key Primary key

23 Operations on Relations Project Project Restrict Restrict

24 Relational Algebra Derived relational operators Derived relational operators –Join Natural join Natural join Performance Performance

25 Extensible RDBMS RDBMS problems when handling spatial data RDBMS problems when handling spatial data –Data structure –Performance –Search

Importing data from CSV Data format Data format –CSV file –First is assumed to be column names –Data values are separated by, and non numeric values are quoted.

Importing data from CSV Create insert file from csv file Create insert file from csv file –/srv/cigi/code/csv2insert.pl --csv-file /srv/cigi/code/test.csv --output-file $HOME/insert.sql --table-name test –/srv/cigi/code/csv2insert.pl --help Getting data to DB Getting data to DB – psql -U username -d database < insertfile

Logging in to the machine % ssh % ssh –Login name: netid –Password: your password % psql -U username –d tutorial % psql -U username –d tutorial –Login name: geog480 –Password: same

29 End of This Class