2005-12-08Copyright© 2005 Oracle Corp.1 SQL/XML Jim Melton USA: Oracle Corp. JTC1 SC32N1632.

Slides:



Advertisements
Similar presentations
9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
1 Constraints, Triggers and Active Databases Chapter 9.
Database Design -- Basic SQL
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Introduction to Structured Query Language (SQL)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 SQL: Data Definition, Constraints, and Basic Queries and Updates.
Introduction to Structured Query Language (SQL)
1 Query Languages: How to build or interrogate a relational database Structured Query Language (SQL)
1 COS 425: Database and Information Management Systems XML and information exchange.
Data Modelling. EAR model This modelling language allows a very small vocabulary: Just as English has nouns, verbs, adjectives, pronouns.., EAR models.
Database Systems More SQL Database Design -- More SQL1.
Introduction to Structured Query Language (SQL)
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
XML and ORACLE Rosa Isela López Aguilar Noviembre 2008.
Module 9 Designing an XML Strategy. Module 9: Designing an XML Strategy Designing XML Storage Designing a Data Conversion Strategy Designing an XML Query.
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
2.2 SQL Server 2005 的 XML 支援功能. Overview XML Enhancements in SQL Server 2005 The xml Data Type Using XQuery.
© 2009 Themis, Inc. All rights reserved. Using XML With DB2 XML-Related Functions and Programming Language Support Gregg Lippa Themis Inc.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Integrating XML with Microsoft SQL Server ©NIITeXtensible Markup Language/Lesson 9/Slide 1 of 31 Objectives In this lesson, you will learn to: * Generate.
Lecture 24 XML processing. 2 XQuery Formal Semantics ‘goal is to complement XPath/XQuery spec, by defining meaning of expressions with mathematical rigor.
Using XML in SQL Server 2005 NameTitleCompany. XML Overview Business Opportunity The majority of all data transmitted electronically between organizations.
Maziar Sanaii Ashtiani – SCT – EMU, Fall 2011/12.
XML Overview. Chapter 8 © 2011 Pearson Education 2 Extensible Markup Language (XML) A text-based markup language (like HTML) A text-based markup language.
WG3 Database Languages Stephen Cannan Convenor
Sofia, Bulgaria | 9-10 October Using XQuery to Query and Manipulate XML Data Stephen Forte CTO, Corzen Inc Microsoft Regional Director NY/NJ (USA) Stephen.
IBM Almaden Research Center © 2006 IBM Corporation On the Path to Efficient XML Queries Andrey Balmin, Kevin Beyer, Fatma Özcan IBM Almaden Research Center.
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
Session IV Chapter 9 – XML Schemas
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 DB2 9 Fundamentals.
10 Copyright © 2009, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
1 Copyright © 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
5/24/01 Leveraging SQL Server 2000 in ColdFusion Applications December 9, 2003 Chris Lomvardias SRA International
CSc-340 3b1 Intermediate SQL Chapter 4 [2 of 2] Phase 1 of Student Projects SQL Data Types & Schemas Authorization.
IBM Software Group ® Native XML Support in DB2 Universal Database Matthias Nicola, Bert van der Linden IBM Silicon Valley Lab Sept 1,
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Exam and Lecture Overview.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Database Lab Lecture 1. Database Languages Data definition language ( DDL ) Data definition language –defines data types and the relationships among them.
Visual Programing SQL Overview Section 1.
XML and Database.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
May 8, :20 a.m. – 10:20 a.m. Platform: DB2 for Linux, UNIX and Windows DB2 9: XML Evolution and Revolution Philip K. Gunning Gunning Technology Solutions,
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Session 1 Module 1: Introduction to Data Integrity
Altering Tables and Constraints Database Systems Objectives Add and modify columns. Add, enable, disable, or remove constraints. Drop a table. Remove.
XPath --XML Path Language Motivation of XPath Data Model and Data Types Node Types Location Steps Functions XPath 2.0 Additional Functionality and its.
Module 3: Using XML. Overview Retrieving XML by Using FOR XML Shredding XML by Using OPENXML Introducing XQuery Using the xml Data Type.
Experience with XML Schema Ashok Malhotra Schema Usage  Mapping XML Schema and XML documents controlled by the Schema to object classes and instances.
Hierarchical Retrieval Fresher Learning Program December, 2011.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 4: Intermediate.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
Pure XML Pertemuan 10 Matakuliah: T0413 Tahun: 2009.
3 A Guide to MySQL.
Fundamentals of DBMS Notes-1.
XML: Extensible Markup Language
TABLES AND INDEXES Ashima Wadhwa.
ATS Application Programming: Java Programming
Querying XML: XQuery, XPath, and SQL/XML in Context
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
IST 318 Database Administration
Database SQL.
XML? What’s this doing in my database? Adam Koehler
Presentation transcript:

Copyright© 2005 Oracle Corp.1 SQL/XML Jim Melton USA: Oracle Corp. JTC1 SC32N1632

Copyright© 2005 Oracle Corp.2 Jim Melton, Oracle Corp. Editor: all parts of SQL standard Editor: XQuery F&O, XQueryX Co-chair: W3C XML Query WG Author: 5 SQL books, plus “Querying XML”, all from Morgan Kaufmann Publishers

Copyright© 2005 Oracle Corp.3 SQL/XML: The Basics

Copyright© 2005 Oracle Corp.4 SQL—Structured Data Based on relational model Tables of rows and columns Every “cell” has a value (possibly null) SQL Query Language extremely powerful (probably too big) Products extremely well- developed: scalable, robust, manageable, etc.

Copyright© 2005 Oracle Corp.5 XML—Semi-Structured Data Foundation for “User” Markup Languages Tree-structured, semi- structured Descended from SGML DTD, XML Schema, RELAX (NG), etc. Rapid Acceptance, Tools Widely Available “We Make Your Data Fatter” (binary XML???) employees emp name sal emp id 473 R. J. MacReady name id 301 Mike Wazowski name salid 132 Korben Dallas ……

Copyright© 2005 Oracle Corp.6 Relational  XML Publishing Functions XMLParse XMLSerialize XMLQuery XMLTable XMLDocument XMLElement –XMLAttribute XMLForest XMLAgg XMLConcat XMLComment XMLPI XMLText

Copyright© 2005 Oracle Corp.7 Relational  XML Example: XMLElement XMLELEMENT ( NAME = "emp" XMLCOMMENT ( "Example 1" ), XMLATTRIBUTES ( EMP_ID AS "id" ), XMLELEMENT ( NAME = "name", NAME ), XMLELEMENT ( NAME = "sal", SALARY ) ) In serialized form: R. J. MacReady

Copyright© 2005 Oracle Corp.8 Relational  XML Mappings SQL identifiers to XML names SQL data types to XML names and Schema data types (& SQL values to XML) SQL tables, schemas, catalogs to XML Schema data types, XML element(s), and XML (documents)+ XML Schema documents)

Copyright© 2005 Oracle Corp.9 XML  Relational Mappings XML names to SQL identifiers Unicode to SQL character sets XQuery atomic values to SQL values

Copyright© 2005 Oracle Corp.10 XML  Relational Storage Considerations VARCHAR CLOB BLOB “Native” XML R. J. MacReady emp name salid 473 R. J. MacReady 35500

Copyright© 2005 Oracle Corp.11 The XML Type & Modifiers XML Primary Modifiers –CONTENT –DOCUMENT –SEQUENCE Secondary Modifiers (CONTENT & DOCUMENT) –UNTYPED –ANY –XMLSCHEMA XML(DOCUMENT(UNTYPED)) XML(CONTENT(XMLSCHEMA))

Copyright© 2005 Oracle Corp.12 The XML Type and Modifiers SEQUENCE DOCUMENT(ANY) CONTENT(ANY) Null or XQuery document node …with exactly 1 element child CONTENT(UNTYPED) xdt:untyped and xdt:untypedAtomic CONTENT(XMLSCHEMA) Validated against some XML Schema DOCUMENT(UNTYPED) …with exactly 1 element child xdt:untyped and xdt:untypedAtomic DOCUMENT(XMLSCHEMA) …with exactly 1 element child Validated against some XML Schema

Copyright© 2005 Oracle Corp.13 Parsing & Serialization XMLParse: Parses a string value using an XML parser; produces value whose specific type is XML(DOCUMENT(ANY)), or …CONTENT…, or …UNTYPED… XMLSerialize: transforms an XML value into a string value (CHAR, VARCHAR, CLOB, or BLOB)

Copyright© 2005 Oracle Corp.14 XQuery Within SQL Problem: How can SQL applications locate and retrieve information in XML documents stored in an SQL database cell? Answer: Invoke XQuery from SQL statements (retrieve—in SELECT list; locate—in WHERE clause)!

Copyright© 2005 Oracle Corp.15 XQuery Within SQL XMLQuery: A new SQL expression, invoked as a pseudo-function, whose data type can be an XML type—such as XML(CONTENT(ANY))—or an ordinary SQL type XMLExists: A new SQL predicate, invoked as a pseudo-function, returning true when the contained XQuery expression returns anything other than the empty sequence (false) or SQL null value (unknown)

Copyright© 2005 Oracle Corp.16 XQuery Within SQL XMLValidate: Validates an XML value against an XML Schema (or target namespace), returning new XML value with type annotations IS VALID: Tests an XML value to determine whether or not it is valid according to an XML Schema (or target namespace); return true/false without altering the XML value itself

Copyright© 2005 Oracle Corp.17 XQuery Within SQL Other new predicates: –IS DOCUMENT: determines whether an XML value satisfies the (SQL/XML) criteria for an XML document –IS CONTENT: determines whether an XML value satisfies the (SQL/XML) criteria for XML content

Copyright© 2005 Oracle Corp.18 XMLTable Provides an SQL view of XML data Evaluates an XQuery “row pattern” with optional arguments (as with XMLQuery) Element/attribute values mapped to columns using XQuery “column patterns” Names & types of columns required; default values optional

Copyright© 2005 Oracle Corp.19 Namespaces Completely supported per XML+Namespaces: –XMLElement, XMLForest, XMLTable –Default namespace, explicit namespace (prefix) –Declare namespace within scopes of WITH clause, column definitions, constraint definitions, insert/delete/update statements, compound statements Built-in namespaces: xs:, xsi:, and sqlxml:

Copyright© 2005 Oracle Corp.20 Validation & Registered Schemas XML Schemas may be registered with the SQL-server –Implementation-defined mechanism –Known by SQL name & by target namespace URI –Used by XMLValidate(), IS VALID, and to restrict values of XML(DOCUMENT-or- CONTENT(XMLSCHEMA))

Copyright© 2005 Oracle Corp.21 Validation & Registered Schemas Registered because of security issues –Schemas cannot “disappear” without SQL- server knowing about it –Schemas cannot be “hijacked” (altered in inappropriate ways) without SQL-server knowing about it –Documents cannot be marked “valid” against schemas unless SQL-server knows about them

Copyright© 2005 Oracle Corp.22 The SQL/XML Standard ISO/IEC :2003 –Mappings and Publishing Functions ISO/IEC :2006 –Adds XQuery, including Data Model, Validation ISO/IEC :2008 (planned) –Full-Text? –Update? –Something else?

Copyright© 2005 Oracle Corp.23 Summary SQL/XML:2003 plus –Additional publishing functions –XQuery data model –More precise XML type (modifiers) –XMLQuery, XMLTable –XMLValidate, IS VALID –XMLExists, IS DOCUMENT, IS CONTENT –Casting between XML type and SQL types

Copyright© 2005 Oracle Corp.24 SQL/XML Questions?