2/1/04 Database Systems: Salman Azhar 1 Object-Relational Databases Salman Azhar User-Defined Types Object IDs Nested Tables These slides use some figures, definitions, and explanations from Elmasri-Navathe’s Fundamentals of Database Systems and Molina-Ullman-Widom’s Database Systems
40
Embed
2/1/04Database Systems: Salman Azhar1 Object-Relational Databases Salman Azhar User-Defined Types Object IDs Nested Tables These slides use some figures,
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
2/1/04 Database Systems: Salman Azhar 1
Object-Relational DatabasesSalman Azhar
User-Defined TypesObject IDs
Nested TablesThese slides use some figures, definitions, and explanations from
Elmasri-Navathe’s Fundamentals of Database Systemsand Molina-Ullman-Widom’s Database Systems
2/1/04 Database Systems: Salman Azhar 2
Merging Relational and Object Models
Object-oriented models support interesting data types --- not just flat
files.• E.g., Maps, multimedia, etc.
The relational model supports very-high-level queries
Object-relational databases are an attempt to get the best of both.
2/1/04 Database Systems: Salman Azhar 3
Evolution of DBMSs
Object-oriented DBMSs fell short because they did not offer the
efficiencies of a relational DBMS. Object-relational extensions to
relational DBMSs capture much of the advantages of OO yet retain the relation as the
fundamental abstraction.
2/1/04 Database Systems: Salman Azhar 4
SQL-99 and DBMS Features
SQL-99 includes many of the object-relational features to be described.
However, being so new, different DBMSs use different approaches. We’ll sometimes use features and
syntax from Oracle and SQL Server.
2/1/04 Database Systems: Salman Azhar 5
User Defined Types
A user-defined type, or UDT, is essentially a class definition, with a structure and methods.
Two uses:1. As a row-type, that is, the type of a
relation.2. As an column-type, that is, the type
if attribute in a relation.
2/1/04 Database Systems: Salman Azhar 6
UDT Definition
CREATE TYPE <typename> AS (<list of elements, as in CREATE TABLE>
); Oracle syntax:
1. Add “OBJECT” as inCREATE TYPE <name> AS OBJECT.
2. Follow with / to have the type stored.
2/1/04 Database Systems: Salman Azhar 7
Example: UDT Definition
CREATE TYPE DealerType AS (
name CHAR(20),
addrCHAR(20)
);
CREATE TYPE CarType AS (
nameCHAR(20),
manfCHAR(20)
);
2/1/04 Database Systems: Salman Azhar 8
References
If T is a type, then REF T is the type of a reference to T this means a pointer to an object of