Adsu 1
Adsu 1
Databases
Unit 1: Object-Oriented Databases
• Complex Data Types and Object Orientation
• Structured Data Types and Inheritance in SQL
• Table Inheritance
• Array and Multiset Types in SQL
• Object Identity and Reference Types in SQL
• Implementing O-R Features
• The query finds the last name and city of each person.
select name.lastname, address.city
from person;
select p.name.lastname from person p;
• The objects Circle, Rectangle and Triangle inherit from the object
Shape.
Mrs. Deepali Jaadhav 33
Array and Multiset Types in SQL
• SQL supports two collection types: arrays and multisets; array types
were added in SQL:1999, while multiset types were added in
SQL:2003.
• An array is a collection of similar data elements stored at
contiguous memory locations. The elements of an array are ordered.
• It is the simplest data structure where each data element can be
accessed directly by only using its index number.
• A multiset is an unordered collection, where an element may occur
multiple times.
• Multisets are like sets, except that a set allows each element to occur
at most once.
• Array construction
array [‘Silberschatz’,`Korth’,`Sudarshan’]
• Multisets
multiset [‘computer’, ‘database’, ‘SQL’]
• To create a tuple of the type defined by the books relation:
(‘Compilers’, array[`Smith’,`Jones’], 16-02-1990,
new Publisher (`McGraw-Hill’,`New York’),
multiset [`parsing’,`analysis’ ])