33-OODB Query Lang
33-OODB Query Lang
Outline
Object definitions
Object Structures
Object-oriented concepts
OODBS
OQL with an example
SQL3 with examples
Definition of an object
Objects User defined complex data types
An object has structure or state (variables) and methods
(behavior/operations)
Query returns:
OQL SQL
Object Tuple
Collection of objects Table
SQL3 Object-oriented SQL
Foundation for several OO database
management systems ORACLE8, DB2, etc
New features relational & Object oriented
Relational Features new data types, new
predicates, enhanced semantics, additional
security and an active database
Object Oriented Features support for
functions and procedures
User defined Data Types
Creating a row type
Example:
create row type AddressType(
street char(50),
city char(20));
select MovieStar.name,
MovieStar.address.street
from MovieStar
where MovieStar.address.city = Columbus;
Complex Data and Queries
A Water Resource Management example
A database of state wide water projects
Geographic locations
Reservoir levels during droughts
Recent flood conditions, etc
Complex Data and Queries
(contd.)
Addressing these queries
Linking this database to landmarks on a
topographic map
Examining the captions for each slide
Implementing image-understanding
programs
Inspecting images and ascertaining
attributes
These type of queries necessitate
dedicated methods
Creating Functions
create function one() returns int4
as select 1 as RESULT'
language 'sql';
answer
select one() as answer;
1
Creating tables with
methods
Implementation
create table slides (
id int,
date date,
caption document,
picture CD_image,
method containsName
(name varchar)
returns boolean
as external name matching
language C );
Creating Tables (Contd.)