Question: Write a SELECT statement with CASE functions to return a result set consisting of the following four columns: the InvoiceNumber column from the Invoices table,
Write a SELECT statement with CASE functions to return a result set consisting of the following four columns: the InvoiceNumber column from the Invoices table, the VendorName column from the Vendors table, a string literal indicating the type of invoices with InvoiceType alias, and a string literal indicating which group a vendor belongs with VendorGroup alias.
If the InvoiceNumber contains any letter (A-Z), the string literal is Type 1.
If the InvoiceNumber does not contain any letter (A-Z), the string literal is Type 2.
If the VendorName begins with the letter A-M, the string literal is Group 1.
If the VendorName begins with the letter N-Z, the string literal is Group 2.
Sort the final result set by InvoiceType, and then by VendorGroup.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
