70
Relational Database Management Relational Database Management Systems Systems Practical Guide Ali Adams Ali Adams Abu Dhabi Men’s College Abu Dhabi Men’s College Higher Colleges of Technology Higher Colleges of Technology

RDBMS Seminar

Embed Size (px)

Citation preview

Page 1: RDBMS Seminar

Relational Database Management Relational Database Management SystemsSystems

Practical Guide

Ali AdamsAli Adams

Abu Dhabi Men’s CollegeAbu Dhabi Men’s CollegeHigher Colleges of TechnologyHigher Colleges of Technology

Page 2: RDBMS Seminar

Information ManagementInformation Management

DataData 2727

InformationInformation age = 27age = 27  

KnowledgeKnowledge if age>25 risk is lowif age>25 risk is low

DecisionDecision set premium to lowset premium to low

Decisions are made based on current information and existing knowledge.

Page 3: RDBMS Seminar

Functions of DBMSFunctions of DBMS

Create, alter and delete tablesCreate, alter and delete tables Add, update, and delete recordsAdd, update, and delete records Extract information from dataExtract information from data Maintain data integrity and securityMaintain data integrity and security Add, update and delete usersAdd, update and delete users Grant and revoke user privilegesGrant and revoke user privileges Data sharing & concurrency controlData sharing & concurrency control Provide API for application buildersProvide API for application builders

Page 4: RDBMS Seminar

Database Development CycleDatabase Development Cycle Prior AnalysisPrior Analysis

Examine the case for commissioning a new GIS database.Examine the case for commissioning a new GIS database.

Logical designLogical designBuild a conceptual data-model of the ‘natural form’ of the data using EAR Build a conceptual data-model of the ‘natural form’ of the data using EAR diagrams and normalize it.diagrams and normalize it.

Physical DesignPhysical DesignMap the conceptual model into tables, fields, keys, indexes, etc for a preferred Map the conceptual model into tables, fields, keys, indexes, etc for a preferred DBMS.DBMS.

TestingTestingTest for functionality correctness and then for design efficiency under the predicted Test for functionality correctness and then for design efficiency under the predicted usage level.usage level.

ImplementationImplementationDeploy the database within its target environment, write user documentation and Deploy the database within its target environment, write user documentation and train users.train users.

MaintenanceMaintenanceIron out any bugs, and schema-evolve the database as the organization evolves.Iron out any bugs, and schema-evolve the database as the organization evolves.

Page 5: RDBMS Seminar

Types of databasesTypes of databases

HierarchicalHierarchical

The hierarchical data-model is essentially a The hierarchical data-model is essentially a treetree structure structure that allows each ‘parent’ entity to own several ‘child’ that allows each ‘parent’ entity to own several ‘child’ entities, but each child belongs to only entities, but each child belongs to only one parentone parent..

Page 6: RDBMS Seminar

Types of databases Types of databases

NetworkNetwork

The The Network data-model Network data-model is similar to the hierarchical is similar to the hierarchical model except that child records are allowed to belong to model except that child records are allowed to belong to many parentmany parent records, and thus any problem of multiple records, and thus any problem of multiple ownership is overcome.ownership is overcome.

Page 7: RDBMS Seminar

Types of databases Types of databases

RelationalRelational

The Relational data-model is based on The Relational data-model is based on set-theoryset-theory which which is tabular and alphanumeric in nature.is tabular and alphanumeric in nature.

Relationships are implemented using shared columns in Relationships are implemented using shared columns in different tables.different tables.

Data is independent of code.Data is independent of code.

Page 8: RDBMS Seminar

Object-Oriented DatabasesObject-Oriented Databases

Page 9: RDBMS Seminar

Types of databases Types of databases

Object-OrientedObject-Oriented

Nested structure of Nested structure of objects maintainedobjects maintained

Objects have identityObjects have identity

Supports class Supports class hierarchy, inheritance hierarchy, inheritance and aggregationand aggregation

Departments

Employees

Equipment

Page 10: RDBMS Seminar

Types of databases Types of databases

Object RelationalObject Relational

ORDBMS are an evolution of RDBMS that addORDBMS are an evolution of RDBMS that addcomplex data typescomplex data types to the simple alphanumeric types. to the simple alphanumeric types.

It borrows ideas from Object-Oriented DatabasesIt borrows ideas from Object-Oriented Databases

Page 11: RDBMS Seminar

Types of databases Types of databases

Web Databases (XDBMS)Web Databases (XDBMS)

Database needs to be Database needs to be Web-enabledWeb-enabled and and XDBMSXDBMS is is emerging to fulfill this need.emerging to fulfill this need.

Standard Web pages are written in HTML Standard Web pages are written in HTML ((Hyper Text Markup LanguageHyper Text Markup Language).).

XML (XML (Extendable Mark-up LanguageExtendable Mark-up Language) allows database ) allows database designers to specify their own extensions to the language designers to specify their own extensions to the language and define their own data-types.and define their own data-types.

XML is the new way to XML is the new way to transfer datatransfer data across the Web. across the Web.

Page 12: RDBMS Seminar

The Relational ModelThe Relational Model

The three elements are:The three elements are:

Structural Element (DDL)Structural Element (DDL)

Manipulation Element (DML)Manipulation Element (DML)

Integrity Element (Integrity Element (Triggers, Validation, ConstraintsTriggers, Validation, Constraints))

Page 13: RDBMS Seminar

The Structural ElementThe Structural Element

Columns in a table must be given distinct namesColumns in a table must be given distinct names

Each row in a table must be distinct Each row in a table must be distinct

All field values in a given column must be drawn All field values in a given column must be drawn from the same domainfrom the same domain

The order of columns and rows has no The order of columns and rows has no significancesignificance

Primary keys used to directly access rows in Primary keys used to directly access rows in tablestables

Foreign keys used to link rows in different tablesForeign keys used to link rows in different tables

Page 14: RDBMS Seminar

Entity relationshipsEntity relationships

Primary Key (Primary Key (underlinedunderlined))

Foreign Keys (Foreign Keys (italicitalic))

Table Definitions:Table Definitions:

PROPERTY (PROPERTY (Uprn#, Name, Address, Value, , Name, Address, Value, ConArea# ConArea# ))

CON_AREA (CON_AREA (ConArea#ConArea#, DateDec, Name, DateDec, Name ))

Page 15: RDBMS Seminar

Entity relationshipsEntity relationshipsPROPERTY tablePROPERTY tableUprn#Uprn# NameName Address Address ValueValue

ConAreaConArea##

11 MayesMayes Jacob’s St. Jacob’s St. 3000030000 1 1

22 BriggsBriggs Rural St. Rural St. 6000060000 null null

33 ReevesReeves Canal St. Canal St. 2800028000 2 2

44 PetchPetch Peace Park Peace Park 5500055000 1 1

55 Cornelius Hope CrescentCornelius Hope Crescent 2500025000 2 2

CON_AREA tableCON_AREA tableConArea#ConArea# DateDecDateDec NameName

11 19701970 Town CentreTown Centre

22 19751975 St. GeorgeSt. George

Find conservation area of property 3 ?

Find the row with Uprn#= 3 in the Property table

Read the value of ConArea# field for this row

Search the Con_Area table for a matching ConArea# value

Read the name of the conservation area from Con_Area table.

Page 16: RDBMS Seminar

The Manipulation ElementThe Manipulation Element

There are three main relational operators:There are three main relational operators: SELECTSELECT PROJECTPROJECT JOINJOIN

And few more:And few more: UNIONUNION INTERSECTINTERSECT DIFFERENCEDIFFERENCE DIVIDEDIVIDE

Page 17: RDBMS Seminar

SELECTSELECT

SELECT FROM Property SELECT FROM Property

WHERE Value >= £50,000 WHERE Value >= £50,000

as Expensive_Propertyas Expensive_Property

EXPENSIVE_PROPERTYEXPENSIVE_PROPERTY

Uprn#Uprn# Name Name Address Address Value Value ConAreaConArea##

22 Briggs Rural St Briggs Rural St 60000 60000 null null

44 Petch Petch Peace Park Peace Park 55000 55000 1 1

Page 18: RDBMS Seminar

PROJECTPROJECT

PROJECT Occupier, Address PROJECT Occupier, Address FROM Property FROM Property as Addressas Address

ADDRESSADDRESSOccupierOccupier AddressAddressMayesMayes Jacob’s StJacob’s StBriggsBriggs Rural StRural StReeveReeve Canal StCanal StPetchPetch Peace ParkPeace ParkCorneliusCornelius Hope CrescentHope Crescent

Page 19: RDBMS Seminar

JOINJOIN

JOIN Property AND Con_Area ON ConArea# JOIN Property AND Con_Area ON ConArea# as Prop_Conas Prop_Con

PROP_CONPROP_CONUprn#Uprn# P.Name AddressP.Name Address ValueValue Con DateCon Date C.NameC.Name

Area#Area# DecDec11 MayesMayes Jacob's St Jacob's St 3000030000 1 1 19701970 Town Town

CentreCentre33 ReeveReeve Canal St Canal St 2800028000 2 2 19751975 St GeorgesSt Georges44 PetchPetch Peace Park Peace Park 5500055000 1 1 19701970 Town Town

CentreCentre55 CorneliusHope Cres.CorneliusHope Cres. 2500025000 2 2 19701970 St GeorgesSt Georges

Page 20: RDBMS Seminar

More Relational OperationsMore Relational Operations

UNIONUNIONUNION Property AND New_Property UNION Property AND New_Property

as All_Propertyas All_Property INTERSECTINTERSECT

New_Property INTERSECT 2bed_Property New_Property INTERSECT 2bed_Property as New_2bed_Propertyas New_2bed_Property

DIFFERENCEDIFFERENCEDIFFERENCE All_Property AND Council_Property DIFFERENCE All_Property AND Council_Property

as Private_Propertyas Private_Property DIVIDEDIVIDE

Divides a table of 2 columns with a table of 1 column.Divides a table of 2 columns with a table of 1 column.

Page 21: RDBMS Seminar

The Integrity ElementThe Integrity ElementCorrectnessCorrectness and and AccuracyAccuracy of the data. of the data.

EntityEntity IntegrityIntegrity Primary key must bePrimary key must be Unique Unique and and Not NullNot Null

ReferentialReferential IntegrityIntegrity.. Foreign key must contain values that Foreign key must contain values that existexist in the primary key in the primary key of another table, or of another table, or NullNull

1.1. Cascade Delete Cascade Delete Deleting the parent row will delete all rows in other tables that Deleting the parent row will delete all rows in other tables that refer to it.refer to it.

2.2. Restrict DeleteRestrict DeleteCannot delete the parent row, unless no row is referring to it from Cannot delete the parent row, unless no row is referring to it from other tables.other tables.

3.3. Set to NullSet to NullUpon deleting the parent row, its primary key is removed from all Upon deleting the parent row, its primary key is removed from all referencing rows in other tables and replaced by Null.referencing rows in other tables and replaced by Null.

Page 22: RDBMS Seminar

Structured Query LanguageStructured Query Language

CompletenessCompletenesscomprehensive database languagecomprehensive database language

SimplicitySimplicityless than 30 SQL commandsless than 30 SQL commands

DeclarativeDeclarativetell the computer what to do, not how to do tell the computer what to do, not how to do

itit Pseudo EnglishPseudo English

verbverb (Create, Select, Grant, Drop, …),(Create, Select, Grant, Drop, …), then then objectobject (database, table, record)(database, table, record)

Page 23: RDBMS Seminar

Database Definition CommandsDatabase Definition Commands

SQL provides these data definition commands:SQL provides these data definition commands:

CREATE TABLECREATE TABLE ALTER TABLEALTER TABLE DROP TABLEDROP TABLE

CREATE VIEWCREATE VIEW DROP VIEWDROP VIEW

CREATE INDEXCREATE INDEX DROP INDEXDROP INDEX

Page 24: RDBMS Seminar

CREATE TABLECREATE TABLE

CREATE TABLE PropertyCREATE TABLE Property

(Uprn# integer NOT NULL,(Uprn# integer NOT NULL,

Occupier char(20),Occupier char(20),

Address char(30),Address char(30),

Value decimal(10.2));Value decimal(10.2));

Page 25: RDBMS Seminar

ALTER TABLEALTER TABLE

ALTER TABLEALTER TABLE

ALTER TABLE PropertyALTER TABLE Property

ADD (ConArea# integer);ADD (ConArea# integer);

Page 26: RDBMS Seminar

DROP TABLEDROP TABLE

DROP TABLEDROP TABLEDROP TABLE Property;DROP TABLE Property;

Page 27: RDBMS Seminar

CREATE VIEWCREATE VIEW

CREATE VIEW ConPropCREATE VIEW ConProp

(ConName, DateDec, Occupier, Address)(ConName, DateDec, Occupier, Address)

ASAS

SELECT Con_Area.Name, Con_Area.DateDec, SELECT Con_Area.Name, Con_Area.DateDec, Property.Name, Property.AddressProperty.Name, Property.Address

FROM Property, Con_AreaFROM Property, Con_Area

WHERE Property.ConArea# = WHERE Property.ConArea# = Con_Area.ConArea#;Con_Area.ConArea#;

Page 28: RDBMS Seminar

DROP VIEWDROP VIEW

DROP VIEWDROP VIEWDROP VIEW ConProp;DROP VIEW ConProp;

Page 29: RDBMS Seminar

CREATE INDEXCREATE INDEX

CREATE INDEX UNIQUE UprnIndexCREATE INDEX UNIQUE UprnIndex

ON Property (Uprn# ASC);ON Property (Uprn# ASC);

Page 30: RDBMS Seminar

DROP INDEXDROP INDEX

DROP INDEXDROP INDEXDROP INDEX UprnIndex;DROP INDEX UprnIndex;

Page 31: RDBMS Seminar

Data Manipulation CommandsData Manipulation Commands

SQL provides four data manipulation SQL provides four data manipulation commands:commands:

INSERT INTOINSERT INTO UPDATE UPDATE DELETE FROMDELETE FROM SELECT SELECT

Page 32: RDBMS Seminar

Examples of Manipulation Examples of Manipulation CommandsCommands

INSERT INTOINSERT INTOINSERT INTO PropertyINSERT INTO Property(Address, Uprn#)(Address, Uprn#)VALUES (Smith St, 6);VALUES (Smith St, 6);

UPDATEUPDATEUPDATE Property UPDATE Property SET Name = “Heywood” Value = 50000SET Name = “Heywood” Value = 50000WHERE Uprn# = 3;WHERE Uprn# = 3;

DELETE FROMDELETE FROMDELETE FROM PropertyDELETE FROM PropertyWHERE Uprn# = 1;WHERE Uprn# = 1;

Page 33: RDBMS Seminar

SELECTSELECT

Selects all records in the Property table:Selects all records in the Property table:

SELECT *SELECT *

FROM Property;FROM Property;

Selects all records in the Con_Area table:Selects all records in the Con_Area table:

SELECT *SELECT *FROM Con_AreaFROM Con_Area;

Page 34: RDBMS Seminar

SELECTSELECT

Selects all properties valued at more than 40000:Selects all properties valued at more than 40000:

SELECT *SELECT *

FROM PropertyFROM Property

WHERE Value > 40000;WHERE Value > 40000;

Page 35: RDBMS Seminar

SELECTSELECT

Selects the names of all properties valued more Selects the names of all properties valued more than the Heywood’s property:than the Heywood’s property:

SELECT NameSELECT Name

FROM PropertyFROM Property

WHERE Value > WHERE Value >

(SELECT Value(SELECT Value

FROM PropertyFROM Property

WHERE Name = “Heywood”); WHERE Name = “Heywood”);

Page 36: RDBMS Seminar

SELECTSELECT

Selects the id of all properties in the St. George Selects the id of all properties in the St. George conservation area that are valued less than 30000:conservation area that are valued less than 30000:

SELECT Uprn#SELECT Uprn#

FROM Property, Con_AreaFROM Property, Con_Area

WHERE Con_Area.Name = ‘St. George’WHERE Con_Area.Name = ‘St. George’

AND Con_Area.ConArea# = Property.ConArea#AND Con_Area.ConArea# = Property.ConArea#

AND Value < 30000;AND Value < 30000;

Page 37: RDBMS Seminar

SELECTSELECT

Using other keywords like:Using other keywords like:

DISTINCTDISTINCT HAVINGHAVING ORDER BYORDER BY GROUP BYGROUP BY

can further refine result of a SELECT statementcan further refine result of a SELECT statement

Page 38: RDBMS Seminar

Data Access Control CommandsData Access Control Commands

SQL provides two data access control commands:

GRANTGRANT REVOKE REVOKE

Page 39: RDBMS Seminar

GRANT

Grant the conservation officer the right to select, update, and alter the ConProp view:

GRANT Select, Update, AlterON ConPropTO ConOfficer;

Page 40: RDBMS Seminar

REVOKE

Revoke the conservation officer the right to alter the ConProp view:

REVOKE AlterON ConPropFROM ConOfficer;

Page 41: RDBMS Seminar

Logical DesignLogical Design

• Entity-Attribute-Relationship (EAR)EAR is used as a preliminary, ‘broad brush’ technique, to develop an initial data model.

• NormalizationNormalization can then be used to fine-tune the preliminary model into a conceptual data-model that is appropriate for use with the target relational database management system.

Page 42: RDBMS Seminar

EAR EAR ModelingModeling

1.1. Identify entities Identify entities - - nounsnouns

2.2. Identify relationships between entitiesIdentify relationships between entities - - verbsverbs

3.3. Identify attributes of entities Identify attributes of entities - - adjectivesadjectives

4.4. Defining Defining tablestables

Page 43: RDBMS Seminar

Identifying EntitiesIdentifying Entities

Entities are ‘objects’ or ‘things’, i.e. anything that can be identified as having an independent existence and about which we needs to collect information.

Examples: Student Course Subject

Page 44: RDBMS Seminar

Identifying RelationshipsIdentifying Relationships

One to One: 1 Husband is married to 1 Wife

One to Many: 1 Mother is parent of 0..m Children

Many to Many: 1 Student takes 1..m Courses 1 Course is taken by 1..m Students

Page 45: RDBMS Seminar

Identifying AttributesIdentifying Attributes

Student entity attributes: Student# Name … Course#

Course entity attributes: Subject# Title Credits …

Page 46: RDBMS Seminar

Defining TablesDefining Tables

STUDENT (Student#, Name, ...)

COURSE (Course#, Title, Credits, ...)

STUDENT-COURSE (Student#, Course#) We introduce this artificial link table to simplify

a many-to-many relationship into two one-to-many relationships.

Student --> Student-Course <-- Course

Page 47: RDBMS Seminar

NormalizationNormalization

1.1. List all attributesList all attributes

2.2. Identify initial tablesIdentify initial tables

3.3. Apply 1Apply 1stst Normalization Normalization

4.4. Apply 2Apply 2ndnd Normalization Normalization

5.5. Apply 3Apply 3rdrd Normalization Normalization6.6. Check Relationships Check Relationships (in case any broke)(in case any broke)

Page 48: RDBMS Seminar

List all attributesList all attributes

Identify all attributes associated with a system and list in one table.

Example:

FACTORY (FactId, Name, Address, DateEst, Area, AreaOfficer, ProdCode, ProdDesc, Brand, …)

Page 49: RDBMS Seminar

Identify initial tablesIdentify initial tables

Group related attributes togetherGroup related attributes together

Example:

FACTORY (FactId, Name, Address, DateEst, Area, AreaOfficer, (ProdCode, ProdDesc, Brand), …)

Page 50: RDBMS Seminar

Apply 1Apply 1stst Normalization Normalization Factor out repeating groups to new tables.

FACTORY2 (FactId, Name, Address, DateEst, AreaNo, AreaOfficer)

MADEBY (FactId, ProdCode, ProdDesc, Brand)

Page 51: RDBMS Seminar

Apply 2Apply 2ndnd Normalization Normalization

If a table has a compound primary key then remove all attributes that don’t depend fully on the complete primary key.

FACTORY2 (FactId, Name, Address, DateEst, AreaNo, AreaOfficer)

MADEBY2 (FactId, ProdCode, Brand)

PRODUCT (ProdCode, ProdDesc)

A table is in 2nd normal form if it is in 1st normal form and all its non-key attributes are dependent upon the FULL compound primary key.

Page 52: RDBMS Seminar

Apply 3Apply 3rdrd Normalization Normalization

A table is in third normal form if it is in second normal form, and each non-key attribute is not dependent on any other non-key attribute.

The AreaOfficer is functionally dependent not only upon FactId but also upon the value of AreaNo (a non-key attribute), so remove this transitive dependency by splitting the table further.

FACTORY3 (FactId, Name, Address, DateEst)

AREA (FactId, AreaNo, AreaOfficer)

Page 53: RDBMS Seminar

Normalization SummaryNormalization Summary

ONE FACT IN ONE PLACE ONE FACT IN ONE PLACE (avoid unnecessary duplications)(avoid unnecessary duplications)

  EACH NON-KEY ATTRIBUTE SHOULD EACH NON-KEY ATTRIBUTE SHOULD BE DEPENDENT ON THEBE DEPENDENT ON THE::

• KEY (1NF),KEY (1NF),• THE WHOLE KEY (2NF) andTHE WHOLE KEY (2NF) and• NOTHING BUT THE KEY (3NF)NOTHING BUT THE KEY (3NF)

Page 54: RDBMS Seminar

Check the relationshipsCheck the relationships

In our case, we will find that we have not got the necessary link in FACTORY to COMPANY, and so will need to insert CompId into FACTORY3.

Eventually, we should end up with the following: FACTORY (FactId, Name, Address, DateEst, CompId, AreaNo)COMPANY (CompId, Name, HQAddress)PRODUCT (ProdCode, ProductDescription)EMPLOYMENT (FactId, SurveyDate, EmpNo)MADEBY (FactId, ProdCode, Brand)AREA (FactId, AreaNo, AreaOfficer)

Page 55: RDBMS Seminar

Physical DesignPhysical Design

• What are the most frequent queries What are the most frequent queries in the system?in the system?

• What is the expected response time?What is the expected response time?

• How big will the database be?How big will the database be?

• What’s the network bandwidth?What’s the network bandwidth?

Page 56: RDBMS Seminar

Response Time FactorsResponse Time Factors

• IndexesIndexes

• Choice of Primary KeysChoice of Primary Keys

• Table SplittingTable Splitting

• Table Combining Table Combining (De-normalization)(De-normalization)

• Query OptimizationQuery Optimization

Page 57: RDBMS Seminar

IndexesIndexes Indexes are applied on frequently used Indexes are applied on frequently used attributes to speed up access to the whole attributes to speed up access to the whole data in a record.data in a record.

An index creates a separate two-column table An index creates a separate two-column table with attributes values sorted asc/desc and the with attributes values sorted asc/desc and the primary key of their records.primary key of their records.

Subsequent access based on this attribute Subsequent access based on this attribute uses binary search to find the value and uses binary search to find the value and immediately follow the primary key into the immediately follow the primary key into the main table.main table.

Page 58: RDBMS Seminar

Candidate AttributesCandidate Attributesfor Indexingfor Indexing

• the the PrimaryPrimary key of any table should key of any table should always be always be uniquely indexeduniquely indexed

• all all ForeignForeign keys should be keys should be indexedindexed as as these are the attributes which are used to these are the attributes which are used to join tables.join tables.

  • frequently usedfrequently used attributes should be attributes should be

indexedindexed, even though it may not be a key , even though it may not be a key field (secondary or alternate key).field (secondary or alternate key).

Page 59: RDBMS Seminar

Choice of Primary KeysChoice of Primary Keys

• SHORT: a short key is more efficient than a long one

• NUMERIC:numeric keys are preferred to alphanumeric keys

• MEANINGLESS: auto-numbered meaningless attributes are well suited

• UNCHANGING: the key attribute should be non-volatile

Page 60: RDBMS Seminar

Table SplittingTable Splitting

RDBMS process narrow tables more efficiently than wide tables.

consider splitting the table into two tables, separating the frequently used attributes from the rarely used ones.

establish a one-to-one relationship between the two new tables.

Page 61: RDBMS Seminar

Table Recombining Table Recombining (De-normalization)(De-normalization)

Combine Combine frequently used attributesfrequently used attributes from separate tables to avoid having to from separate tables to avoid having to perform repeated join operations. perform repeated join operations.

   Recombining is de-normalization and may Recombining is de-normalization and may

begin to experience the begin to experience the update, insert update, insert andand deletion anomalies deletion anomalies which are which are designed out of databases in 3NF.designed out of databases in 3NF.

Will introduce Will introduce data duplicationdata duplication and and increase in database size.increase in database size.

Page 62: RDBMS Seminar

Query OptimizationQuery Optimization

Frequently used queries should be Frequently used queries should be optimized for an optimal response time.optimized for an optimal response time.

In a WHERE clause, the order of AND-ed In a WHERE clause, the order of AND-ed conditions can greatly influence the conditions can greatly influence the performance of the query:performance of the query:

Selecting a small subset and then joining it with Selecting a small subset and then joining it with another medium/large subset is much faster than another medium/large subset is much faster than the other way round.the other way round.

Page 63: RDBMS Seminar

SQL History and GISSQL History and GIS SQL-86: SQL-86: First ‘bare bones’ SQL standard published by ANSI (American First ‘bare bones’ SQL standard published by ANSI (American

National Standards Institute).National Standards Institute).    SQL-89: SQL-89: Revised standard published by ISO (International Standards Revised standard published by ISO (International Standards

Organization).Organization).    SQL-2 (SQL-92):SQL-2 (SQL-92): Forward-looking revision specifying future development Forward-looking revision specifying future development

of SQL.of SQL.

SQL-3 (SQL-99): SQL-3 (SQL-99): Most significant revision for Most significant revision for GISGIS was was published in 1999. It accommodates ideas drawn from the published in 1999. It accommodates ideas drawn from the Object Oriented database approach to provide a basis for Object Oriented database approach to provide a basis for an an object-relationalobject-relational approach – approach – classesclasses, , objectsobjects, , complex data-typescomplex data-types, , inheritanceinheritance, etc., etc.

SQL-3 MMSQL-3 MM (Multi-Media) part, provides support for (Multi-Media) part, provides support for manipulating manipulating spatialspatial data. data.

Page 64: RDBMS Seminar

Spatial CapabilitySpatial Capability

Oracle SpatialOracle Spatial is built on is built on SQL-3 MMSQL-3 MM

• Network Data Model

• Topology Data Model

• Spatial Analytic Functions

• Geocoder (Universal coordinate system)

Page 65: RDBMS Seminar

Oracle 10g spatial featuresOracle 10g spatial features

• Network Data ModelNetwork Data Model – This model – This model explicitly stores and maintains connectivity explicitly stores and maintains connectivity within networks and provides network within networks and provides network analysis capability such as analysis capability such as shortest pathshortest path and and connectivity analysisconnectivity analysis..

• The network data model also enables The network data model also enables Oracle's new Oracle's new Java-based geocoding Java-based geocoding engine. engine.

Page 66: RDBMS Seminar

Oracle 10g spatial featuresOracle 10g spatial features

• Topology Data ModelTopology Data Model – This data model and – This data model and schema persistently schema persistently store topologystore topology in the Oracle in the Oracle database.database.

• Persistent topology is a strong requirement for Persistent topology is a strong requirement for maintaining data integrity across maps and layers.maintaining data integrity across maps and layers.

• Persistent topology also speeds queries involving Persistent topology also speeds queries involving relationships among features like adjacency, relationships among features like adjacency, connectivity, and containment. connectivity, and containment.

Page 67: RDBMS Seminar

Oracle 10g spatial featuresOracle 10g spatial features

• GeoRasterGeoRaster – This new data type manages – This new data type manages georeferenced raster imagery (satellite georeferenced raster imagery (satellite imagery, remotely sensed data). imagery, remotely sensed data).

• The GeoRaster feature includes an XML The GeoRaster feature includes an XML schema for managing metadata and for schema for managing metadata and for basic operations like basic operations like pyramidingpyramiding, , tilingtiling and and interleavinginterleaving. .

Page 68: RDBMS Seminar

Oracle 10g spatial featuresOracle 10g spatial features

• Spatial Analytic FunctionsSpatial Analytic Functions – New spatial – New spatial analysis capabilities include classification, analysis capabilities include classification, binning, association and spatial binning, association and spatial correlation. correlation.

• These capabilities are essential for These capabilities are essential for business intelligence applications and are business intelligence applications and are the foundation of spatially-enabled data the foundation of spatially-enabled data mining. mining.

Page 69: RDBMS Seminar

Oracle 10g spatial featuresOracle 10g spatial features

• GeocoderGeocoder - Geocoding is the process of - Geocoding is the process of associating geographic references like associating geographic references like addressaddress and postal codes with and postal codes with latitudelatitude and and longitudelongitude coordinates. coordinates.

• Oracle's geocoding engine is used with Oracle's geocoding engine is used with 3rd party data for functions like 3rd party data for functions like international address standardizationinternational address standardization and and point of interest matchingpoint of interest matching. .

Page 70: RDBMS Seminar

Questions & AnswersQuestions & Answers

Ali Adams

Higher Colleges of Technology

www.geocities.com/aliadams

[email protected]