Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In SQL, 3. Write a SELECT statement that returns these columns from the Vendors

ID: 3822954 • Letter: I

Question

In SQL,

3. Write a SELECT statement that returns these columns from the Vendors table:
- The vendor name column
- The vendor name column in all capital letters
- The vendor phone column
- A column that displays the last 4 digits of each phone number
When you get that working right, add the Columns that follow to the result set. This is more difficult because these columns require the use of functions within functions.
- The vendor_phone column with the parts of the number separated by dots. Ex. 555.555.5555
- A column that displays the second word in each vendor_name if there is one, and blanks if there isnt.

4. Write a SELECT statement that returns these columns from the Invoices table:
- The invoice_number column
- The invoice_date column
- The invoice_date column plus 30 days
- The payment_date column
- A column named DAYS_TO_PAY that shows the number of days between the invoice date and the payment date
- The number of the invoice_date's month
- The four-digit year of the invoice date
When you have this working, add a WHERE clause that retrieves just the invoices for the month of May based on the invoice date, not the number of the invoice month.

Explanation / Answer

3. first find the length of vendor_phone column and decrease it by 3 and then starting from that index use substring to print last 4 digits Select vendor_name ,Convert(varchar(60), upper(vendor_name)), substring(vendor_phone,len(vendor_phone) -3,4) from Vendors; 4. Select invoice_number,invoice_date,DATE_ADD(invoice_date,INTERVAL 30 DAY), payment_date, datediff(invoice_date,payment_date) as DAYS_TO_PAY, Month(invoice_date), year(invoice_date) from Invoices where MONTHNAME(invoice_date) = 'May';

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote