Question: Write a SELECT statement that returns these column names and data from the Invoices table: invoice_number - The invoice number column invoice_date - The invoice_date

Write a SELECT statement that returns these column names and data from the Invoices table: invoice_number - The invoice number column invoice_date - The invoice_date column. invoice_total - The Invoice_total column. payment_total - The Payment_total column. difference_amt - The value of payment_total subtracted from the invoice_total. Return only the rows where the difference_amt is not equal to zero. Returns 15 rows.

What i've managed to come up so far is: "select invoice_number, invoice_date, invoice_total, payment_total, (invoice_total - payment_total) AS difference_amt

FROM invoices

WHERE difference_amt IS NOT NULL

LIMIT 15;

I'm not sure how to go about subtracting invoice_total from payment_total and then create the column "difference_amt" using an alias.. but when i execute theres no value for "difference_amt".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!