《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 29 Object-Based Databases

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

Complex Types and SQL ■ Extensions introduced in SQL:1999 to support complex types: Collection and large object types Nested relations are an example of collection types ·Structured types Nested record structures like composite attributes ·Inheritance ·Object orientation Including object identifiers and references Not fully implemented in any database system currently But some features are present in each of the major commercial database systems Read the manual of your database system to see what it supports Database System Concepts-7th Edition 29.7 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 29.7 ©Silberschatz, Korth and Sudarshan th Edition Complex Types and SQL ▪ Extensions introduced in SQL:1999 to support complex types: • Collection and large object types ▪ Nested relations are an example of collection types • Structured types ▪ Nested record structures like composite attributes • Inheritance • Object orientation ▪ Including object identifiers and references ▪ Not fully implemented in any database system currently • But some features are present in each of the major commercial database systems ▪ Read the manual of your database system to see what it supports

Structured Types and Inheritance in SQL Structured types (a.k.a.user-defined types)can be declared and used in SQL create type Name as (firstname varchar(20), lastname varchar(20)) final create type Address as (street varchar(20), city varchar(20). zipcode varchar(20)) not final 。 Note:final and not final indicate whether subtypes can be created Structured types can be used to create tables with composite attributes create table person name Name, address Address, dateOfBirth date) Dot notation used to reference components:name.firstname Database System Concepts-7th Edition 29.8 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 29.8 ©Silberschatz, Korth and Sudarshan th Edition Structured Types and Inheritance in SQL ▪ Structured types (a.k.a. user-defined types) can be declared and used in SQL create type Name as (firstname varchar(20), lastname varchar(20)) final create type Address as (street varchar(20), city varchar(20), zipcode varchar(20)) not final • Note: final and not final indicate whether subtypes can be created ▪ Structured types can be used to create tables with composite attributes create table person ( name Name, address Address, dateOfBirth date) ▪ Dot notation used to reference components: name.firstname

Structured Types (cont.) User-defined row types create type PersonType as( name Name, address Address, dateOfBirth date) not final Can then create a table whose rows are a user-defined type create table customer of CustomerType Alternative using unnamed row types. create table person r name row(firstname varchar(20), lastname varchar(20)), address row(street varchar(20), city varchar(20), zipcode varchar(20)), dateOfBirth date) Database System Concepts-7th Edition 29.9 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 29.9 ©Silberschatz, Korth and Sudarshan th Edition Structured Types (cont.) ▪ User-defined row types create type PersonType as ( name Name, address Address, dateOfBirth date) not final ▪ Can then create a table whose rows are a user-defined type create table customer of CustomerType ▪ Alternative using unnamed row types. create table person_r( name row(firstname varchar(20), lastname varchar(20)), address row(street varchar(20), city varchar(20), zipcode varchar(20)), dateOfBirth date)

Methods Can add a method declaration with a structured type. method ageOnDate(onDate date) returns interval year Method body is given separately. create instance method ageOnDate(onDate date) returns interval year for CustomerType begin return onDate-self.dateOfBirth; end We can now find the age of each customer: select name.lastname,ageOnDate(current_date) from customer Database System Concepts-7th Edition 29.10 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 29.10 ©Silberschatz, Korth and Sudarshan th Edition Methods ▪ Can add a method declaration with a structured type. method ageOnDate (onDate date) returns interval year ▪ Method body is given separately. create instance method ageOnDate (onDate date) returns interval year for CustomerType begin return onDate - self.dateOfBirth; end ▪ We can now find the age of each customer: select name.lastname, ageOnDate (current_date) from customer

Constructor Functions Constructor functions are used to create values of structured types E.g., create function Name(firstname varchar(20),lastname varchar(20)) returns Name begin set self.firstname firstname; set self.lastname lastname, end To create a value of type Name,we use new Name(John','Smith') Normally used in insert statements insert into Person values (new Name('John','Smith), new Address(20 Main St','New York','11001) date‘1960-8-22); Database System Concepts-7th Edition 29.11 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 29.11 ©Silberschatz, Korth and Sudarshan th Edition Constructor Functions ▪ Constructor functions are used to create values of structured types ▪ E.g., create function Name(firstname varchar(20), lastname varchar(20)) returns Name begin set self.firstname = firstname; set self.lastname = lastname; end ▪ To create a value of type Name, we use new Name(‘John’, ‘Smith’) ▪ Normally used in insert statements insert into Person values (new Name(‘John’, ‘Smith), new Address(’20 Main St’, ‘New York’, ‘11001’), date ‘1960-8-22’);
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 28 Advanced Relational Database Design.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 27 Formal-Relational Query Languages.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 26 Blockchain Databases.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 25 Advanced Application Development.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 24 Advanced Indexing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 23 Parallel and Distributed Transaction Processing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 22 Parallel and Distributed Query Processing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 21 Parallel and Distributed Storage.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 20 Database System Architectures.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 2 Intro to Relational Model.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 19 Recovery System.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 18 Concurrency Control.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 17 Transactions.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 16 Query Optimization.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 15 Query Processing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 14 Indexing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 13 Data Storage Structures.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 12 Physical Storage Systems.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 11 Data Analytics.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 10 Big Data.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 3 Introduction to SQL.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 30 XML.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 31 Information Retrieval.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 4 Intermediate SQL.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 5 Advanced SQL.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 6 Database Design Using the E-R Model.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 7 Normalization.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 8 Complex Data Types.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 9 Application Development.pptx
- 计算机科学与技术教学资源(参考文献)The generalized Cholesky factorization method for saddle point problems.pdf
- 计算机科学与技术教学资源(参考文献)Inverse updating and downdating for weighted linear least squares using M-invariant reflections.pdf
- 计算机科学与技术教学资源(参考文献)Analysis of peaks and plateaus in a Galerkin/minimal residual pair of methods.pdf
- 计算机科学与技术教学资源(参考文献)Perturbation analysis for the generalized Cholesky factorization.pdf
- 计算机科学与技术教学资源(参考文献)STABILITY OF THE MATRIX FACTORIZATION FOR SOLVING BLOCK TRIDIAGONAL SYMMETRIC INDEFINITE LINEAR SYSTEMS.pdf
- 计算机科学与技术教学资源(参考文献)A Convergent Restarted GMRES Method For Large Linear Systems.pdf
- 计算机科学与技术教学资源(参考文献)Properties and Computations of Matrix Pseudospectra.pdf
- 计算机科学与技术(参考文献)A Novel Constrained Texture Mapping Method Based on Harmonic Map.pdf
- 计算机科学与技术(参考文献)A Robust and Fast Non-local Algorithm for Image Denoising.pdf
- 计算机科学与技术(参考文献)Efficient View Manipulation for Cuboid-Structured Images.pdf
- 计算机科学与技术(参考文献)Ensemble of trusted firmware services based on TPM.pdf