Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

XML Description

Customer Table                          SalesOrderHeader Table                      
==============                         ==============
CustomerId                                    [SalesOrderID]
[AccountNumber]                         [CustomerID]
[TerritoryID]                                   [OrderDate]
                                                         [SubTotal]

Below, there are 8 xml presentations (XML_A, XML_B,...XML_H). Only XML_A has a description as shown below.

Question: Could you please provide the description for each of XML_B, XML_C, ..., XML_H?

I have the description for XML_A shown below. I need a similar description for each of XML_B, XML_C, ..., XML_H below:.
XML_A description: display rows from the SalesOrderHeader table for the Customer row  
=====================================
<row SalesOrderID="43793" OrderDate="2011-06-21T00:00:00" SubTotal="3399.9900" AccountNumber="AW00011000" TerritoryID="9" />
<row SalesOrderID="51522" OrderDate="2013-06-20T00:00:00" SubTotal="2341.9700" AccountNumber="AW00011000" TerritoryID="9" />
<row SalesOrderID="57418" OrderDate="2013-10-03T00:00:00" SubTotal="2507.0300" AccountNumber="AW00011000" TerritoryID="9" />

XML_B: >>> display what.... (You provide the description for this  XML)<<<
=====================================
<row>
  <SalesOrderID>43793</SalesOrderID>
  <OrderDate>2011-06-21T00:00:00</OrderDate>
  <SubTotal>3399.9900</SubTotal>
  <AccountNumber>AW00011000</AccountNumber>
  <TerritoryID>9</TerritoryID>
</row>
<row>
  <SalesOrderID>51522</SalesOrderID>
  <OrderDate>2013-06-20T00:00:00</OrderDate>
  <SubTotal>2341.9700</SubTotal>
  <AccountNumber>AW00011000</AccountNumber>
  <TerritoryID>9</TerritoryID>
</row>
<row>
  <SalesOrderID>57418</SalesOrderID>
  <OrderDate>2013-10-03T00:00:00</OrderDate>
  <SubTotal>2507.0300</SubTotal>
  <AccountNumber>AW00011000</AccountNumber>
  <TerritoryID>9</TerritoryID>
</row>

XML_C: >>> display what.... (You provide the description for this  XML)<<<
=====================================
<o SalesOrderID="43793" OrderDate="2011-06-21T00:00:00" SubTotal="3399.9900">
  <c AccountNumber="AW00011000" TerritoryID="9" />
</o>
<o SalesOrderID="51522" OrderDate="2013-06-20T00:00:00" SubTotal="2341.9700">
  <c AccountNumber="AW00011000" TerritoryID="9" />
</o>
<o SalesOrderID="57418" OrderDate="2013-10-03T00:00:00" SubTotal="2507.0300">
  <c AccountNumber="AW00011000" TerritoryID="9" />
</o>

XML_D: >>> display what.... (You provide the description for this  XML)<<<
=====================================
<o>
  <SalesOrderID>43793</SalesOrderID>
  <OrderDate>2011-06-21T00:00:00</OrderDate>
  <SubTotal>3399.9900</SubTotal>
  <c>
    <AccountNumber>AW00011000</AccountNumber>
    <TerritoryID>9</TerritoryID>
  </c>
</o>
<o>
  <SalesOrderID>51522</SalesOrderID>
  <OrderDate>2013-06-20T00:00:00</OrderDate>
  <SubTotal>2341.9700</SubTotal>
  <c>
    <AccountNumber>AW00011000</AccountNumber>
    <TerritoryID>9</TerritoryID>
  </c>
</o>
<o>
  <SalesOrderID>57418</SalesOrderID>
  <OrderDate>2013-10-03T00:00:00</OrderDate>
  <SubTotal>2507.0300</SubTotal>
  <c>
    <AccountNumber>AW00011000</AccountNumber>
    <TerritoryID>9</TerritoryID>
  </c>
</o>

XML_E: >>> display what.... (You provide the description for this  XML)<<<
=====================================
<c AccountNumber="AW00011000" TerritoryID="9">
  <o SalesOrderID="43793" OrderDate="2011-06-21T00:00:00" SubTotal="3399.9900" />
  <o SalesOrderID="51522" OrderDate="2013-06-20T00:00:00" SubTotal="2341.9700" />
  <o SalesOrderID="57418" OrderDate="2013-10-03T00:00:00" SubTotal="2507.0300" />
</c>

XML_F: >>> display what.... (You provide the description for this  XML)<<<
=====================================
<c AccountNumber="AW00011000" TerritoryID="9">
  <o SalesOrderID="43793" OrderDate="2011-06-21T00:00:00" SubTotal="3399.9900" />
  <o SalesOrderID="51522" OrderDate="2013-06-20T00:00:00" SubTotal="2341.9700" />
  <o SalesOrderID="57418" OrderDate="2013-10-03T00:00:00" SubTotal="2507.0300" />
</c>

XML_G: >>> display what.... (You provide the description for this  XML)<<<
=====================================
<Sales.Customer Name="AW00011000" Country="9">
  <SalesOrderID>43793</SalesOrderID>
  <OrderDate>2011-06-21T00:00:00</OrderDate>
  <SubTotal>3399.9900</SubTotal>
</Sales.Customer>
<Sales.Customer Name="AW00011000" Country="9">
  <SalesOrderID>51522</SalesOrderID>
  <OrderDate>2013-06-20T00:00:00</OrderDate>
  <SubTotal>2341.9700</SubTotal>
</Sales.Customer>
<Sales.Customer Name="AW00011000" Country="9">
  <SalesOrderID>57418</SalesOrderID>
  <OrderDate>2013-10-03T00:00:00</OrderDate>
  <SubTotal>2507.0300</SubTotal>
</Sales.Customer>

XML_H: >>> display what.... (You provide the description for this  XML)<<<
=====================================
 <Customers>
  <Customer>
    <Name>AW00011000</Name>
    <Country>9</Country>
  </Customer>
  <SalesOrderID>43793</SalesOrderID>
  <OrderDate>2011-06-21T00:00:00</OrderDate>
  <SubTotal>3399.9900</SubTotal>
</Customers>
<Customers>
  <Customer>
    <Name>AW00011000</Name>
    <Country>9</Country>
  </Customer>
  <SalesOrderID>51522</SalesOrderID>
  <OrderDate>2013-06-20T00:00:00</OrderDate>
  <SubTotal>2341.9700</SubTotal>
</Customers>
<Customers>
  <Customer>
    <Name>AW00011000</Name>
    <Country>9</Country>
  </Customer>
  <SalesOrderID>57418</SalesOrderID>
  <OrderDate>2013-10-03T00:00:00</OrderDate>
  <SubTotal>2507.0300</SubTotal>
</Customers>

Open in new window


XML_A: display rows from the SalesOrderHeader table for the Customer row

XML_B: >>> You provide the description<<<

XML_C: >>> You provide the description<<<

XML_D: >>> You provide the description<<<

XML_E: >>> You provide the description<<<

XML_F: >>> You provide the description<<<

XML_G: >>> You provide the description<<<

XML_H: >>> You provide the description<<<

And, just in case you were interested in the queries generating the above XMLs see below:
Use AdventureWorks2014
GO
SELECT 
	   [CustomerID]		--CustomerId
      ,[AccountNumber]	--Name
      ,[TerritoryID]	--Country
  FROM [Sales].[Customer]

  SELECT
       [SalesOrderID]	--OrderId
      ,[CustomerID]		--CustomerId
	  ,[OrderDate]		--OrderDate
      ,[SubTotal]		--Amount
  FROM [Sales].[SalesOrderHeader]
  

--xml_A
  Select [SalesOrderID], OrderDate
  , [SubTotal], c.[AccountNumber], c.[TerritoryID]
  From [Sales].[SalesOrderHeader] o inner join [Sales].[Customer] c
  on o.[CustomerID]=c.[CustomerID]
  Where c.[CustomerID]=11000 
  for xml raw; 
  
--xml_B
   Select [SalesOrderID], OrderDate
  , [SubTotal], c.[AccountNumber], c.[TerritoryID]
  From [Sales].[SalesOrderHeader] o inner join [Sales].[Customer] c
  on o.[CustomerID]=c.[CustomerID]
  Where c.[CustomerID]=11000 
  for xml raw, elements;

--xml_C
   Select [SalesOrderID], OrderDate
  , [SubTotal], c.[AccountNumber], c.[TerritoryID]
  From [Sales].[SalesOrderHeader] o inner join [Sales].[Customer] c
  on o.[CustomerID]=c.[CustomerID]
  Where c.[CustomerID]=11000 
  for xml Auto;

--xml_D
   Select [SalesOrderID], OrderDate
  , [SubTotal], c.[AccountNumber], c.[TerritoryID]
  From [Sales].[SalesOrderHeader] o inner join [Sales].[Customer] c
  on o.[CustomerID]=c.[CustomerID]
  Where c.[CustomerID]=11000 
  for xml Auto, elements;

--xml_E
   Select c.[AccountNumber], c.[TerritoryID]
  , o.[SalesOrderID], o.[OrderDate], o.[SubTotal]
  From [Sales].[SalesOrderHeader] o inner join [Sales].[Customer] c
  on o.[CustomerID]=c.[CustomerID]
  Where c.[CustomerID]=11000 
  for xml Auto;

--xml_F
   Select c.[AccountNumber], c.[TerritoryID]
     , [SalesOrderID], OrderDate, [SubTotal]  
  From [Sales].[SalesOrderHeader] o inner join [Sales].[Customer] c
  on o.[CustomerID]=c.[CustomerID]
  Where c.[CustomerID]=11000 
  for xml Auto;

--xml_G
   Select c.[AccountNumber] AS '@Name', c.[TerritoryID] As '@Country'
     , [SalesOrderID], OrderDate, [SubTotal]  
  From [Sales].[SalesOrderHeader] o inner join [Sales].[Customer] c
  on o.[CustomerID]=c.[CustomerID]
  Where c.[CustomerID]=11000 for xml Path('Sales.Customer');

--xml_H
   Select c.[AccountNumber] AS 'Customer/Name', c.[TerritoryID] As 'Customer/Country'
     , [SalesOrderID], OrderDate, [SubTotal]  
  From [Sales].[SalesOrderHeader] o inner join [Sales].[Customer] c
  on o.[CustomerID]=c.[CustomerID]
  Where c.[CustomerID]=11000 for xml Path('Customers');

Open in new window

Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

Is this homework? This looks like the AdventureWorks schema to me.

I guess I am having a hard time understanding the need for the XML descriptions. Are you trying to develop some interface on the AdventureWorks schema as a sample for some team to use?
Avatar of Mike Eghtebas

ASKER

This is an existing QA. for more see: (The attached doc file has the same info.)
User generated imageXML_A_B_Question_EE.docx
ASKER CERTIFIED SOLUTION
Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nakul,

I am grateful for the time and effort you put on this. It is really helpful.

Just to let you know XML_F is not included yet.

Mike
Thank you very much.