Question: Write a SELECT statement that returns an XML document that contains all of the invoices in the Invoices table that have more than one line

Write a SELECT statement that returns an XML document that contains all of the invoices in the Invoices table that have more than one line item. This document should include one element for each of the following columns:

InvoiceNumber

InvoiceDate

InvoiceTotal

InvoiceLineItemDescription

InvoiceLineItemAmount

Hint: Below is the SQL part of the query that you should use so that all you have to add is the XML part

SELECT InvoiceNumber, InvoiceDate, InvoiceTotal, InvoiceLineItemDescription AS ItemDescription, InvoiceLineItemAmount AS ItemAmount FROM Invoices AS Invoice JOIN InvoiceLineItems AS LineItem ON Invoice.InvoiceID = LineItem.InvoiceID WHERE Invoice.InvoiceID IN ( SELECT InvoiceID FROM InvoiceLineItems GROUP BY InvoiceID HAVING COUNT(*) > 1) ORDER BY InvoiceDate

Save the XML document that is returned in a file named MultipleLineItems.xml

Generate an XML schema for the file and save it in a file named MultipleLineItems.xsd

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!