How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Satchi Your Own Question

Satchi
Satchi, Consultant
Category: Programming
Satisfied Customers: 2442
Experience:  C# SQLServer Oracle11gR2 .net 4.0 ASP.Net VisualStudio 2010 HTML JAVAScript
18133961
Type Your Programming Question Here...
Satchi is online now
A new question is answered every 9 seconds

1.Write a SELECT statement that returns four columns based

This answer was rated:

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 1.

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 1 and style 10, respectively.
•Use the CAST function to return the fourth column as data type real.

3.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.

4.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.

5.Modify the search expression for InvoiceDueDate from the solution for exercise 4.
Rather than 30 days from today, return invoices due before the last day of the current month.

Here are the files.
http://wikisend.com/download/163200/SQL Diagram.docx
http://wikisend.com/download/456316/sql8_allfiles.zip

Satchi :

Hi Welcome to Justanswer, I will be more than happy to assist you with your issue.

Satchi :

Please give me one day time

Satchi :

I am currently very busy and will be able to help you tomorrow...

Customer:

I need it by 1 pm. Is that going to be a problem?

Customer:

Are you going to be able to answer it by then?

Satchi :

let me work on it tonight then

Customer:

OK, I will check back in the morning to see if it's completed. Thank you.

Satchi :

yeah its my 11:22 PM now

Satchi :

feeeling sleepy...

Satchi :

:(

Satchi :

I will send you whatever I can tonight

Customer:

same here, we must be in the same time zone

Satchi :

yeah..

Satchi :

I am in Florida

Customer:

same

Satchi :

I am in Jupiter-33458

Customer:

Jacksonville- 32218

Satchi :

ok

Satchi :

there you go

Satchi :

the Last one is taking more time...

Satchi :

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 1.


select
cast(invoicetotal as decimal) as Column1 ,
cast(invoicetotal as varchar) as Column2,
convert(decimal,invoicetotal) as column3,
convert(Varchar,invoicetotal) as column4
from invoices ;


Unable to convert decimal from type money.Overflow.


 



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 1 and style 10, respectively. •Use the CAST function to return the fourth column as data type real.

select
cast(invoicedate as varchar) as column1,
Convert(varchar,invoicedate, 1) as column2,
Convert(varchar,invoicedate ,10) as column3,
cast(invoicedate as real) as column4
from invoices


 


3.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.


select
(vendorcontactfname+' '+vendorcontactLname) as contact,
substring(vendorphone,6,15) as phone
from vendors
where patindex('%559%',substring(vendorphone,1,5))>0
order by vendorcontactfname,vendorcontactLname



4.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.


select * from invoices where credittotal>0 and (datediff(day, getdate(),invoiceduedate) >30)


 


5.Modify the search expression for InvoiceDueDate from the solution for exercise 4. Rather than 30 days from today, return invoices due before the last day of the current month. Here are the files.


 

Satchi :

not sure if I can complete it by tomorrow

Customer:

I figured out the last one. Thank you for your help.

Satchi and 2 other Programming Specialists are ready to help you