Outline 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 Persistent Programming Languages Comparison of Object-Oriented and Object-Relational Databases Database System Concepts-7th Edition 29.2 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 29.2 ©Silberschatz, Korth and Sudarshan th Edition Outline ▪ 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 ▪ Persistent Programming Languages ▪ Comparison of Object-Oriented and Object-Relational Databases
Object-Relational Data Models Extend the relational data model by including object orientation and constructs to deal with added data types. Allow attributes of tuples to have complex types,including non-atomic values such as nested relations. ■ Preserve relational foundations,in particular the declarative access to data,while extending modeling power. Upward compatibility with existing relational languages. Database System Concepts-7th Edition 29.3 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 29.3 ©Silberschatz, Korth and Sudarshan th Edition Object-Relational Data Models ▪ Extend the relational data model by including object orientation and constructs to deal with added data types. ▪ Allow attributes of tuples to have complex types, including non-atomic values such as nested relations. ▪ Preserve relational foundations, in particular the declarative access to data, while extending modeling power. ▪ Upward compatibility with existing relational languages
Complex Data Types ■Motivation: Permit non-atomic domains (atomic indivisible) Example of non-atomic domain:set of integers,or set of tuples Allows more intuitive modeling for applications with complex data Intuitive definition: Allow relations whenever we allow atomic(scalar)values -relations within relations Retains mathematical foundation of relational model Violates first normal form. Database System Concepts-7th Edition 29.4 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 29.4 ©Silberschatz, Korth and Sudarshan th Edition Complex Data Types ▪ Motivation: • Permit non-atomic domains (atomic indivisible) • Example of non-atomic domain: set of integers, or set of tuples • Allows more intuitive modeling for applications with complex data ▪ Intuitive definition: • Allow relations whenever we allow atomic (scalar) values — relations within relations • Retains mathematical foundation of relational model • Violates first normal form
Example of a Nested Relation Example:library information system ■Each book has ·Title, A list (array)of authors, Publisher,with subfields name and branch,and ·A set of keywords Non-1NF relation books title author_array publisher keyword_set (nane,branch) Compilers [Smith,Jones] (McGraw-Hill,New York) parsing,analysis] Networks [Jones,Frick] (Oxford,London) Internet,Web} Database System Concepts-7th Edition 29.5 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 29.5 ©Silberschatz, Korth and Sudarshan th Edition Example of a Nested Relation ▪ Example: library information system ▪ Each book has • Title, • A list (array) of authors, • Publisher, with subfields name and branch, and • A set of keywords ▪ Non-1NF relation books
4NF Decomposition of Nested Relation Suppose for simplicity that title title author position uniquely identifies a book Compilers Smith 1 ·In real world ISBN is a Compilers Jones 2 unique identifier Networks Jones 1 Networks Frick 2 Decompose books into 4NF authors using the schemas: .(title,author,position) title keyword Compilers parsing ·(title,keyword) Compilers analysis (title,pub-name,pub- Networks Internet branch) Networks Web 4NF design requires users to keywords include joins in their queries. title pub_name pub_branch Compilers McGraw-Hill New York Networks Oxford London books4 Database System Concepts-7th Edition 29.6 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 29.6 ©Silberschatz, Korth and Sudarshan th Edition 4NF Decomposition of Nested Relation ▪ Suppose for simplicity that title uniquely identifies a book • In real world ISBN is a unique identifier ▪ Decompose books into 4NF using the schemas: • (title, author, position) • (title, keyword ) • (title, pub-name, pubbranch ) ▪ 4NF design requires users to include joins in their queries