SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
Fall 2013
insert into
'Advanced_Database_Course’
('Title','Author') values(
‘Object-Based Databases‘,
‘Farzad Nozarian‘
);
•Summary
Overview1
Complex Data Types2
Structured Types and
Inheritance in SQL
3
Structured Types3.1
Type Inheritance3.2
•Summary
Table Inheritance4
Array and Multiset Types in SQL5
Querying Collection-Valued
Attributes
5.2
Nesting and Unnesting5.3
Creating and Accessing
Collection Values
5.1
Overview
• richer type system including complex data types and
object orientation
•Overview
Obstacles using the relational data model
Object-relational database systems
• limited type system support
• difficulty in accessing database data from in C++ or Java
Object-relational data model
• migrate for users who wish to use object-oriented features
•Overview
Persistence
Storage
management
Concurrency
Recovery
Querying
DBMS
Object-Oriented Database
complex objects
object identity
encapsulation
types & classes
class hierarchy
extensibility
Computational
completeness
overriding &
overloading
Object-Oriented System
+
•Overview
• Motivation for the development of complex data types
• Object-relational database systems
• Supporting persistence for data
• object-oriented database system
• object-relational mapping
• Object-relational approach Vs. object-oriented approach
Overview
Complex Data Types
•Complex Data Types
Example1 : addresses
Example 2: phone numbers
(street, address, city, state, postal code)
Atomic data item of type string
A better alternative structured data types
The alternative of normalization by creating a
new relation is expensive and artificial for this example.
Using normalization ?!
•Complex Data Types
A library application
satisfies 4NF
Several domains will be non-atomic
•Complex Data Types
The 4NF design requires queries to join multiple relations,
whereas the non-1NF design makes many types of queries
easier.
The typical user or programmer of an information-retrieval
system thinks of the database in terms of books having sets
of authors, as the non-1NF design models.
Overview
Complex Data Types
Structured Types and Inheritance in SQL
•Structured Types and Inheritance in SQL
Structured Types
Allow composite attributes of E-R designs to be
represented directly
create type Name as
(firstname varchar(20),
lastname varchar(20)) final;
create type Address as(street varchar(20),
city varchar(20),
zipcode varchar(9))
not final;
•Structured Types and Inheritance in SQL
Structured Types
We can now use these types to create
composite attributes in a relation
create table person(
name Name,
address Address,
dateOfBirth date);
The components of a composite attribute can
be accessed using a “dot” notation
•Structured Types and Inheritance in SQL
Structured Types
We can also create a table whose rows are of a
user-defined type
create type PersonType as (
name Name,
address Address,
dateOfBirth date)
not final
create table person
of PersonType;
•Structured Types and Inheritance in SQL
Structured Types
An alternative way of defining composite
attributes in SQL is to use types.
create table person_r(
name row (firstname varchar(20),lastname varchar(20)),
address row (street varchar(20),city varchar(20),zipcode
varchar(9)),
dateOfBirth date);
select name.lastname,address.city
from person;
name and address have
rows of the table also have an !
finds the last name and city of each person
•Structured Types and Inheritance in SQL
Structured Types
create type PersonType as (
name Name,
address Address,
dateOfBirth date)
not final
method ageOnDate(onDate date)
returns interval year;
A structured
type can have
methods
defined on it !
•Structured Types and Inheritance in SQL
Structured Types
Can I create the method body separately ?
create instance method ageOnDate(onDate date)
returns interval year
for PersonType
begin
return onDate−self.dateOfBirth;
end
• which type this method is for
can contain
procedural statements!
• refers to the Person instance on which the method is invoked
• this method executes on an instance of the Person type
Yes !
How to find the age
of each person ?
•Structured Types and Inheritance in SQL
Structured Types
select name.lastname,
ageOnDate(current_date)
from person;
create function Name( firstname varchar(20), lastname varchar(20) )
returns Name
begin
set self.firstname = firstname;
set self.lastname = lastname;
end
•Structured Types and Inheritance in SQL
Structured Types
constructor functions are used to create values of structured types
How we can create a value of Name type ?
new Name(’John’, ’Smith’)
•Structured Types and Inheritance in SQL
Structured Types
Example : Create a new tuple in the Person
relation
insert into Person
values
( new Name(’John’, ’Smith’),
new Address(’20 Main St’, ’New York’, ’11001’),
date ’1960-8-22’);
Note !
By default every structured type has a constructor with no arguments,
which sets the attributes to their default values
•Structured Types and Inheritance in SQL
Type Inheritance
create type Person
(name varchar(20),
address varchar(20));
create type Student
under Person
(degree varchar(20),
department varchar(20));
create type Teacher
under Person
(salary integer,
department varchar(20));
•Structured Types and Inheritance in SQL
Type Inheritance
Can you create a TeachingAssistant type ?
Methods of a structured type are inherited by its
subtypes using overriding method
The keyword final says that subtypes may not be
created from the given type
not final says that subtypes may be created.
create type TeachingAssistant
under Student, Teacher;
Yes !
•Structured Types and Inheritance in SQL
Type Inheritance
any problem ?!
name
address in
department in
Person
Teacher
Student
create type TeachingAssistant
under Student with(department as student_dept),
Teacher with(department as teacher_dept);
Note!
The SQL standard
does not support
multiple inheritance
Overview
Complex Data Types
Structured Types and Inheritance in SQL
Table Inheritance
•Table Inheritance
Subtables in SQL correspond to the E-R notion of
specialization/generalization.
create table people of Person;
create table students of Student
under people;
create table teachers of Teacher
under people;
•Table Inheritance
Question
delete from people where P ;only people
Array and Multiset Types in SQL
Overview
Complex Data Types
Structured Types and Inheritance in SQL
Table Inheritance
•Array and Multiset Types in SQL
SQL supports two collection types
arrays
multisets
SQL:1999
SQL:2003
create type Publisher as
(name varchar(20),
branch varchar(20));
create type Book as
(title varchar(20),
author_array varchar(20) array[10],
pub_date date,
publisher Publisher,
keyword_set varchar(20) multiset);
create table books of Book;
•Array and Multiset Types in SQL
Creating and Accessing Collection Values
An array of values can be created in SQL:1999 in this way:
array[’Silberschatz’, ’Korth’, ’Sudarshan’]
A multiset of keywords can be constructed as follows:
multiset[’computer’, ’database’, ’SQL’]
insert into books
values (’Compilers’, array[’Smith’, ’Jones’],
new Publisher(’McGraw-Hill’, ’New York’),
multiset [’parsing’, ’analysis’] );
But, How we
can access or
update
elements of an
array ?
•Array and Multiset Types in SQL
Querying Collection-Valued Attributes
find all books that have the
word “database” as one of
their keywords
select title from books
where ’database’ in (
unnest (keyword_set) );
select author_array[1],author_array[2],author_array[3]
from books
where title = ’Database System Concepts’;
•Array and Multiset Types in SQL
Querying Collection-Valued Attributes
select B.title, A.author
from books as B, unnest (B.authorarray) as
A(author);
select title, A.author, A.position
from books as B,
unnest(B.author_array) with ordinality as A(author,
position);
Thanks

Mais conteúdo relacionado

Mais procurados

Clustering: Large Databases in data mining
Clustering: Large Databases in data miningClustering: Large Databases in data mining
Clustering: Large Databases in data miningZHAO Sam
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database conceptsTemesgenthanks
 
Database architecture
Database architectureDatabase architecture
Database architectureVENNILAV6
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMSMegha Patel
 
Data Mining: clustering and analysis
Data Mining: clustering and analysisData Mining: clustering and analysis
Data Mining: clustering and analysisDataminingTools Inc
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMSkoolkampus
 
Introduction to distributed database
Introduction to distributed databaseIntroduction to distributed database
Introduction to distributed databaseSonia Panesar
 
Challenges of Conventional Systems.pptx
Challenges of Conventional Systems.pptxChallenges of Conventional Systems.pptx
Challenges of Conventional Systems.pptxGovardhanV7
 
Naming in Distributed Systems
Naming in Distributed SystemsNaming in Distributed Systems
Naming in Distributed SystemsNandakumar P
 
Data Integration and Transformation in Data mining
Data Integration and Transformation in Data miningData Integration and Transformation in Data mining
Data Integration and Transformation in Data miningkavitha muneeshwaran
 
4.2 spatial data mining
4.2 spatial data mining4.2 spatial data mining
4.2 spatial data miningKrish_ver2
 
Object Relational Database Management System(ORDBMS)
Object Relational Database Management System(ORDBMS)Object Relational Database Management System(ORDBMS)
Object Relational Database Management System(ORDBMS)Rabin BK
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architecturesPooja Dixit
 

Mais procurados (20)

Map Reduce
Map ReduceMap Reduce
Map Reduce
 
Clustering: Large Databases in data mining
Clustering: Large Databases in data miningClustering: Large Databases in data mining
Clustering: Large Databases in data mining
 
Create table
Create tableCreate table
Create table
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
 
Parallel Database
Parallel DatabaseParallel Database
Parallel Database
 
Database architecture
Database architectureDatabase architecture
Database architecture
 
Query processing
Query processingQuery processing
Query processing
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
Data Mining: clustering and analysis
Data Mining: clustering and analysisData Mining: clustering and analysis
Data Mining: clustering and analysis
 
Ordbms
OrdbmsOrdbms
Ordbms
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMS
 
Introduction to distributed database
Introduction to distributed databaseIntroduction to distributed database
Introduction to distributed database
 
Odbms concepts
Odbms conceptsOdbms concepts
Odbms concepts
 
Challenges of Conventional Systems.pptx
Challenges of Conventional Systems.pptxChallenges of Conventional Systems.pptx
Challenges of Conventional Systems.pptx
 
Naming in Distributed Systems
Naming in Distributed SystemsNaming in Distributed Systems
Naming in Distributed Systems
 
Data Integration and Transformation in Data mining
Data Integration and Transformation in Data miningData Integration and Transformation in Data mining
Data Integration and Transformation in Data mining
 
4.2 spatial data mining
4.2 spatial data mining4.2 spatial data mining
4.2 spatial data mining
 
Kdd process
Kdd processKdd process
Kdd process
 
Object Relational Database Management System(ORDBMS)
Object Relational Database Management System(ORDBMS)Object Relational Database Management System(ORDBMS)
Object Relational Database Management System(ORDBMS)
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architectures
 

Destaque

Big Data Processing in Cloud Computing Environments
Big Data Processing in Cloud Computing EnvironmentsBig Data Processing in Cloud Computing Environments
Big Data Processing in Cloud Computing EnvironmentsFarzad Nozarian
 
S4: Distributed Stream Computing Platform
S4: Distributed Stream Computing PlatformS4: Distributed Stream Computing Platform
S4: Distributed Stream Computing PlatformFarzad Nozarian
 
Big data Clustering Algorithms And Strategies
Big data Clustering Algorithms And StrategiesBig data Clustering Algorithms And Strategies
Big data Clustering Algorithms And StrategiesFarzad Nozarian
 
آشنایی با داده‌های بزرگ و تکنیک‌های برنامه‌سازی برای پردازش داده‌های بزرگ
آشنایی با داده‌های بزرگ و تکنیک‌های برنامه‌سازی برای پردازش داده‌های بزرگآشنایی با داده‌های بزرگ و تکنیک‌های برنامه‌سازی برای پردازش داده‌های بزرگ
آشنایی با داده‌های بزرگ و تکنیک‌های برنامه‌سازی برای پردازش داده‌های بزرگAmir Sedighi
 
The Continuous Distributed Monitoring Model
The Continuous Distributed Monitoring ModelThe Continuous Distributed Monitoring Model
The Continuous Distributed Monitoring ModelFarzad Nozarian
 
Tank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engineTank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engineFarzad Nozarian
 
Hadoop Case Studies in the Real World in Persian - کاربردهای هدوپ در دنیای واقعی
Hadoop Case Studies in the Real World in Persian - کاربردهای هدوپ در دنیای واقعیHadoop Case Studies in the Real World in Persian - کاربردهای هدوپ در دنیای واقعی
Hadoop Case Studies in the Real World in Persian - کاربردهای هدوپ در دنیای واقعیMobin Ranjbar
 
Apache HDFS - Lab Assignment
Apache HDFS - Lab AssignmentApache HDFS - Lab Assignment
Apache HDFS - Lab AssignmentFarzad Nozarian
 
Big Data and select suitable tools
Big Data and select suitable toolsBig Data and select suitable tools
Big Data and select suitable toolsMeghdad Hatami
 
عظيم داده چيست؟
عظيم داده چيست؟عظيم داده چيست؟
عظيم داده چيست؟digidanesh
 
A Story of Big Data:Introduction
A Story of Big Data:IntroductionA Story of Big Data:Introduction
A Story of Big Data:IntroductionMobin Ranjbar
 
Big data بزرگ داده ها
Big data بزرگ داده هاBig data بزرگ داده ها
Big data بزرگ داده هاOmid Sohrabi
 
کلان داده کاربردها و چالش های آن
کلان داده کاربردها و چالش های آنکلان داده کاربردها و چالش های آن
کلان داده کاربردها و چالش های آنHamed Azizi
 
Introduction to Apache Hadoop in Persian - آشنایی با هدوپ
Introduction to Apache Hadoop in Persian - آشنایی با هدوپIntroduction to Apache Hadoop in Persian - آشنایی با هدوپ
Introduction to Apache Hadoop in Persian - آشنایی با هدوپMobin Ranjbar
 
Apache HBase - Lab Assignment
Apache HBase - Lab AssignmentApache HBase - Lab Assignment
Apache HBase - Lab AssignmentFarzad Nozarian
 
Apache Hadoop MapReduce Tutorial
Apache Hadoop MapReduce TutorialApache Hadoop MapReduce Tutorial
Apache Hadoop MapReduce TutorialFarzad Nozarian
 
Big Data and Cloud Computing
Big Data and Cloud ComputingBig Data and Cloud Computing
Big Data and Cloud ComputingFarzad Nozarian
 

Destaque (20)

Big Data Processing in Cloud Computing Environments
Big Data Processing in Cloud Computing EnvironmentsBig Data Processing in Cloud Computing Environments
Big Data Processing in Cloud Computing Environments
 
Apache Spark Tutorial
Apache Spark TutorialApache Spark Tutorial
Apache Spark Tutorial
 
S4: Distributed Stream Computing Platform
S4: Distributed Stream Computing PlatformS4: Distributed Stream Computing Platform
S4: Distributed Stream Computing Platform
 
Big data Clustering Algorithms And Strategies
Big data Clustering Algorithms And StrategiesBig data Clustering Algorithms And Strategies
Big data Clustering Algorithms And Strategies
 
آشنایی با داده‌های بزرگ و تکنیک‌های برنامه‌سازی برای پردازش داده‌های بزرگ
آشنایی با داده‌های بزرگ و تکنیک‌های برنامه‌سازی برای پردازش داده‌های بزرگآشنایی با داده‌های بزرگ و تکنیک‌های برنامه‌سازی برای پردازش داده‌های بزرگ
آشنایی با داده‌های بزرگ و تکنیک‌های برنامه‌سازی برای پردازش داده‌های بزرگ
 
The Continuous Distributed Monitoring Model
The Continuous Distributed Monitoring ModelThe Continuous Distributed Monitoring Model
The Continuous Distributed Monitoring Model
 
Tank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engineTank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engine
 
Hadoop Case Studies in the Real World in Persian - کاربردهای هدوپ در دنیای واقعی
Hadoop Case Studies in the Real World in Persian - کاربردهای هدوپ در دنیای واقعیHadoop Case Studies in the Real World in Persian - کاربردهای هدوپ در دنیای واقعی
Hadoop Case Studies in the Real World in Persian - کاربردهای هدوپ در دنیای واقعی
 
Shark - Lab Assignment
Shark - Lab AssignmentShark - Lab Assignment
Shark - Lab Assignment
 
Apache HDFS - Lab Assignment
Apache HDFS - Lab AssignmentApache HDFS - Lab Assignment
Apache HDFS - Lab Assignment
 
Big Data and select suitable tools
Big Data and select suitable toolsBig Data and select suitable tools
Big Data and select suitable tools
 
Apache Storm Tutorial
Apache Storm TutorialApache Storm Tutorial
Apache Storm Tutorial
 
عظيم داده چيست؟
عظيم داده چيست؟عظيم داده چيست؟
عظيم داده چيست؟
 
A Story of Big Data:Introduction
A Story of Big Data:IntroductionA Story of Big Data:Introduction
A Story of Big Data:Introduction
 
Big data بزرگ داده ها
Big data بزرگ داده هاBig data بزرگ داده ها
Big data بزرگ داده ها
 
کلان داده کاربردها و چالش های آن
کلان داده کاربردها و چالش های آنکلان داده کاربردها و چالش های آن
کلان داده کاربردها و چالش های آن
 
Introduction to Apache Hadoop in Persian - آشنایی با هدوپ
Introduction to Apache Hadoop in Persian - آشنایی با هدوپIntroduction to Apache Hadoop in Persian - آشنایی با هدوپ
Introduction to Apache Hadoop in Persian - آشنایی با هدوپ
 
Apache HBase - Lab Assignment
Apache HBase - Lab AssignmentApache HBase - Lab Assignment
Apache HBase - Lab Assignment
 
Apache Hadoop MapReduce Tutorial
Apache Hadoop MapReduce TutorialApache Hadoop MapReduce Tutorial
Apache Hadoop MapReduce Tutorial
 
Big Data and Cloud Computing
Big Data and Cloud ComputingBig Data and Cloud Computing
Big Data and Cloud Computing
 

Semelhante a Advanced Database Course Object-Oriented Features Overview

Semelhante a Advanced Database Course Object-Oriented Features Overview (20)

Object relational and extended relational databases
Object relational and extended relational databasesObject relational and extended relational databases
Object relational and extended relational databases
 
Ch9
Ch9Ch9
Ch9
 
215 oodb
215 oodb215 oodb
215 oodb
 
Oodb
OodbOodb
Oodb
 
Oodb
OodbOodb
Oodb
 
OODB
OODBOODB
OODB
 
ch9
ch9ch9
ch9
 
Chapter2
Chapter2Chapter2
Chapter2
 
Ch9
Ch9Ch9
Ch9
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/Hibernate
 
Object oriented database
Object oriented databaseObject oriented database
Object oriented database
 
SQLITE Android
SQLITE AndroidSQLITE Android
SQLITE Android
 
Databases, SQL and MS SQL Server
Databases, SQL and MS SQL ServerDatabases, SQL and MS SQL Server
Databases, SQL and MS SQL Server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
My sql
My sqlMy sql
My sql
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
lecture5.ppt
lecture5.pptlecture5.ppt
lecture5.ppt
 
Tech Gupshup Meetup On MongoDB - 24/06/2016
Tech Gupshup Meetup On MongoDB - 24/06/2016Tech Gupshup Meetup On MongoDB - 24/06/2016
Tech Gupshup Meetup On MongoDB - 24/06/2016
 
Obtain better data accuracy using reference tables
Obtain better data accuracy using reference tablesObtain better data accuracy using reference tables
Obtain better data accuracy using reference tables
 
Structure in C language
Structure in C languageStructure in C language
Structure in C language
 

Último

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Último (20)

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

Advanced Database Course Object-Oriented Features Overview

  • 1. Fall 2013 insert into 'Advanced_Database_Course’ ('Title','Author') values( ‘Object-Based Databases‘, ‘Farzad Nozarian‘ );
  • 2. •Summary Overview1 Complex Data Types2 Structured Types and Inheritance in SQL 3 Structured Types3.1 Type Inheritance3.2
  • 3. •Summary Table Inheritance4 Array and Multiset Types in SQL5 Querying Collection-Valued Attributes 5.2 Nesting and Unnesting5.3 Creating and Accessing Collection Values 5.1
  • 5. • richer type system including complex data types and object orientation •Overview Obstacles using the relational data model Object-relational database systems • limited type system support • difficulty in accessing database data from in C++ or Java Object-relational data model • migrate for users who wish to use object-oriented features
  • 6. •Overview Persistence Storage management Concurrency Recovery Querying DBMS Object-Oriented Database complex objects object identity encapsulation types & classes class hierarchy extensibility Computational completeness overriding & overloading Object-Oriented System +
  • 7. •Overview • Motivation for the development of complex data types • Object-relational database systems • Supporting persistence for data • object-oriented database system • object-relational mapping • Object-relational approach Vs. object-oriented approach
  • 9. •Complex Data Types Example1 : addresses Example 2: phone numbers (street, address, city, state, postal code) Atomic data item of type string A better alternative structured data types The alternative of normalization by creating a new relation is expensive and artificial for this example. Using normalization ?!
  • 10. •Complex Data Types A library application satisfies 4NF Several domains will be non-atomic
  • 11. •Complex Data Types The 4NF design requires queries to join multiple relations, whereas the non-1NF design makes many types of queries easier. The typical user or programmer of an information-retrieval system thinks of the database in terms of books having sets of authors, as the non-1NF design models.
  • 12. Overview Complex Data Types Structured Types and Inheritance in SQL
  • 13. •Structured Types and Inheritance in SQL Structured Types Allow composite attributes of E-R designs to be represented directly create type Name as (firstname varchar(20), lastname varchar(20)) final; create type Address as(street varchar(20), city varchar(20), zipcode varchar(9)) not final;
  • 14. •Structured Types and Inheritance in SQL Structured Types We can now use these types to create composite attributes in a relation create table person( name Name, address Address, dateOfBirth date); The components of a composite attribute can be accessed using a “dot” notation
  • 15. •Structured Types and Inheritance in SQL Structured Types We can also create a table whose rows are of a user-defined type create type PersonType as ( name Name, address Address, dateOfBirth date) not final create table person of PersonType;
  • 16. •Structured Types and Inheritance in SQL Structured Types An alternative way of defining composite attributes in SQL is to use types. create table person_r( name row (firstname varchar(20),lastname varchar(20)), address row (street varchar(20),city varchar(20),zipcode varchar(9)), dateOfBirth date); select name.lastname,address.city from person; name and address have rows of the table also have an ! finds the last name and city of each person
  • 17. •Structured Types and Inheritance in SQL Structured Types create type PersonType as ( name Name, address Address, dateOfBirth date) not final method ageOnDate(onDate date) returns interval year; A structured type can have methods defined on it !
  • 18. •Structured Types and Inheritance in SQL Structured Types Can I create the method body separately ? create instance method ageOnDate(onDate date) returns interval year for PersonType begin return onDate−self.dateOfBirth; end • which type this method is for can contain procedural statements! • refers to the Person instance on which the method is invoked • this method executes on an instance of the Person type Yes !
  • 19. How to find the age of each person ? •Structured Types and Inheritance in SQL Structured Types select name.lastname, ageOnDate(current_date) from person;
  • 20. create function Name( firstname varchar(20), lastname varchar(20) ) returns Name begin set self.firstname = firstname; set self.lastname = lastname; end •Structured Types and Inheritance in SQL Structured Types constructor functions are used to create values of structured types How we can create a value of Name type ? new Name(’John’, ’Smith’)
  • 21. •Structured Types and Inheritance in SQL Structured Types Example : Create a new tuple in the Person relation insert into Person values ( new Name(’John’, ’Smith’), new Address(’20 Main St’, ’New York’, ’11001’), date ’1960-8-22’); Note ! By default every structured type has a constructor with no arguments, which sets the attributes to their default values
  • 22. •Structured Types and Inheritance in SQL Type Inheritance create type Person (name varchar(20), address varchar(20)); create type Student under Person (degree varchar(20), department varchar(20)); create type Teacher under Person (salary integer, department varchar(20));
  • 23. •Structured Types and Inheritance in SQL Type Inheritance Can you create a TeachingAssistant type ? Methods of a structured type are inherited by its subtypes using overriding method The keyword final says that subtypes may not be created from the given type not final says that subtypes may be created. create type TeachingAssistant under Student, Teacher; Yes !
  • 24. •Structured Types and Inheritance in SQL Type Inheritance any problem ?! name address in department in Person Teacher Student create type TeachingAssistant under Student with(department as student_dept), Teacher with(department as teacher_dept); Note! The SQL standard does not support multiple inheritance
  • 25. Overview Complex Data Types Structured Types and Inheritance in SQL Table Inheritance
  • 26. •Table Inheritance Subtables in SQL correspond to the E-R notion of specialization/generalization. create table people of Person; create table students of Student under people; create table teachers of Teacher under people;
  • 27. •Table Inheritance Question delete from people where P ;only people
  • 28. Array and Multiset Types in SQL Overview Complex Data Types Structured Types and Inheritance in SQL Table Inheritance
  • 29. •Array and Multiset Types in SQL SQL supports two collection types arrays multisets SQL:1999 SQL:2003 create type Publisher as (name varchar(20), branch varchar(20)); create type Book as (title varchar(20), author_array varchar(20) array[10], pub_date date, publisher Publisher, keyword_set varchar(20) multiset); create table books of Book;
  • 30. •Array and Multiset Types in SQL Creating and Accessing Collection Values An array of values can be created in SQL:1999 in this way: array[’Silberschatz’, ’Korth’, ’Sudarshan’] A multiset of keywords can be constructed as follows: multiset[’computer’, ’database’, ’SQL’] insert into books values (’Compilers’, array[’Smith’, ’Jones’], new Publisher(’McGraw-Hill’, ’New York’), multiset [’parsing’, ’analysis’] ); But, How we can access or update elements of an array ?
  • 31. •Array and Multiset Types in SQL Querying Collection-Valued Attributes find all books that have the word “database” as one of their keywords select title from books where ’database’ in ( unnest (keyword_set) ); select author_array[1],author_array[2],author_array[3] from books where title = ’Database System Concepts’;
  • 32. •Array and Multiset Types in SQL Querying Collection-Valued Attributes select B.title, A.author from books as B, unnest (B.authorarray) as A(author); select title, A.author, A.position from books as B, unnest(B.author_array) with ordinality as A(author, position);