1. Write a SELECT statement that returns four columns based on the InvoiceTotal column of the Invoices table:
Use the CAST function to return the first column as data type decimal with 2 digits to the right of the decimal point.
Use CAST to return the second column as a varchar.
Use the CONVERT function to return the third column as the same data type as the first column.
Use CONVERT to return the fourth column as a varchar, using style l.
2. Write a SELECT statement that returns four columns based on the InvoiceDate column of the Invoices table:
Use the CAST function to return the first column as data type varchar.
Use the CONVERT function to return the second and third columns as a varchar, using style I and style 10, respectively.
Use the CAST function to return the fourth column as data type real.
1. Write a SELECT statement that returns two columns based on the Vendors table. The first column, Contact, is the vendor contact name in this format: first name followed by last initial (for example, "John S.") The second column, Phone, is the VendorPhone column without the area code. Only return rows for those vendors in the 559 area code. Sort the result set by first name, then last name.
2. Write a SELECT statement that returns the InvoiceNumber and balance due for every invoice with a non-zero balance and an InvoiceDueDate that's less than 30 days from today.
4. Write a summary query WITH CUBE that returns LineltemSum (which is the sum of InvoiceLineItemAmount) grouped by Account (an alias for AccountDescription) and State (an alias for VendorState). Use the CASE and GROUPING function to substitute the literal value "*ALL*" for the summary rows with null values.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.