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

4. Write a SELECT statement that returns the InvoiceNumber and balance due for e

ID: 3547015 • Letter: 4

Question

                                4. Write a SELECT statement that returns the InvoiceNumber and balance due for every invoice with a non-zero balance and an InvoiceDateDue that's                                 less than 30days from today.
                                
                                7. Add a column to the query described in exercise 4 that uses the RANK() function to return a column named BalanceRank that ranks the balance due                                 in descending order.                             

                                
                            

                                
                            

                                
                            

                                6. Write a SELECT statement that returns a single value that represents the sum of the largest unpaid invoices submitted to each vendor. Use a                                 derived table that returns MAX (InvoiceTotal) grouped by VendorID, filtering for invoices with a balance due.
                            

                                
                            

                                9. Rewrite exercise 6 so it uses a common table expression(CTE) instead of a derived table.                             

Explanation / Answer

6.sounds to me like you need to create a view of the largest unpaid invoices. you would use a create view statement with a query to select max(invoicetotal)-->what you wrote<-- and then group by the id in order to get the max for each one. and then select the sum of that value from the view or else you could do it all with one query. if you told me how your tables were set up i could give you a clearer picture.

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