Reference no: EM132163017
USEING SQL Server Database Development
Open the AP database using the SQL Server 2012 Management Studio. Please make sure you review the SQL syntax for each query that is created.
Please create solutions to the following queries:
1. Write a select statement that returns four columns based on the InvoiceTotal column of the invoices table, AP database.
a. Use the CAST function to return the first column with 0 digits to the right of the decimal point
b. Use the CAST function to return the second column with a $ in front of the value.
c. Using the CONVERT function to return the third column with the smallest precision in mind to return the scale of 3.
d. Use the CONVERT function to return the fourth column with a $ in front and back of the value. There should be no spaces between the symbols and number. i.e $3,813.33$
One row example without the headers:
3813 $3813.33 3813.330 $3,813.33$
2. Write a SELECT statement that returns two columns based on the Vendors table. The first column, Contact, is the vendor contact name, the second is the phone.
a. For the contact, the first name is followed by last name initial (for example, "John S.")
b. The second column, Phone, is the VendorPhone column without the area code.
Criteria:
1) Only return rows for those vendors in the 559 area code. You can only use the numbers "559" in the search, no parenthesis.
2) Sort the result set by last name.
One row example with headers:
Contact Phone
Thom A. 555-8484