PostgreSQL :- XMLTABLE Function

Background A far more easier choice to parse XML data is to use the XMLTable function. Lineage Here are past postings on XML parsing options in PostgreSQL :- XPath XPATH Link   Data Here is a sample of the XML file. Image XMLTABLE Query Outline XMLTable Path /bible/b/c/v Passing Column Name contextxml Columns book path … Continue reading PostgreSQL :- XMLTABLE Function

PostgreSQL :- XPATH Function

Background We have our XML file imported into the database. Objective Let us start to make sense of of it. XPATH We can use the XPATH function to query it. Data Here is what our XML looks like. Image Query Outline Common Table Expression ( CTE ) To compartmentalize things a bit we use a … Continue reading PostgreSQL :- XPATH Function

Transact SQL :- XQuery – Union – Basic Study

Background Wanted to hopefully do a better job showing how to use XPath or clause. Basket Query Get Apples ( /item/type => apple ) SQL Output Get Pears ( /item/type => pear ) SQL Output Get Apples or Pears ( /item/type => apple or pear ) => Use XPath Union Outline Use XPath Union Each … Continue reading Transact SQL :- XQuery – Union – Basic Study

Transact SQL :- XQuery – Union

Background I have been working with an XML document, but never bothered looking at the DTD. Thankfully Thankfully today I found I was missing some patterns. And, so need to quickly understand how to perform Xpath OR matching; I guess it is called XPath Union. Sample XML Fragment Here is a sample XML fragment. Code … Continue reading Transact SQL :- XQuery – Union

Transact SQL – XQuery – Ancestor

Background Playing around with XML, but dug in a quicksand. XML Here is the XML Image Code Code Code Find Nodes whose element matches specific value SQL Output Pass X PATH :- Child::bar/Attribute SQL Output Find Descendants SQL Output Find Ascendants SQL Output Output - Textual Output - Image Source Code Control Git Hub TransactSQLXQuery/ancenstor/ … Continue reading Transact SQL – XQuery – Ancestor

XQuery/Transact SQL – Case Sensitivity

Background When issuing XPath queries, XQuery in SQL, one has to keep in mind that though the database itself could be defined as case-insensitive, XML is case-sensitive.   Create & Populate Data Create Table SQL Populate Table with data SQL Data   Queries Normal Queries Fetch all data Fetch data whose part name is Teeth … Continue reading XQuery/Transact SQL – Case Sensitivity