Question

SELECT vendor_name, TO_CHAR(INVOICE_TOTAL - (PAYMENT_TOTAL + CREDIT_TOTAL),'$999,999.90') AS "AMTDUE" 2 FROM AP.VENDORS 3 JOIN AP.INVOICES 4...

SELECT vendor_name, TO_CHAR(INVOICE_TOTAL - (PAYMENT_TOTAL + CREDIT_TOTAL),'$999,999.90') AS "AMTDUE"
2 FROM AP.VENDORS
3 JOIN AP.INVOICES
4 ON vendors.vendor_id = invoices.vendor_id
5 GROUP BY vendor_name
6 WHERE (INVOICE_TOTAL - (PAYMENT_TOTAL + CREDIT_TOTAL)) > 0;
WHERE (INVOICE_TOTAL - (PAYMENT_TOTAL + CREDIT_TOTAL)) > 0
*
ERROR at line 6:
ORA-00933: SQL command not properly ended

Homework Answers

Answer #1

Dear Student ,

As per requirement submitted above kindly find below solution.

Error details :

  • group by should be the last clause
  • where need to be used before the group by clause
  • This SQL query needs to use having clause

Below is the correct query

SELECT
   vendor_name,
   TO_CHAR(INVOICE_TOTAL - (PAYMENT_TOTAL + CREDIT_TOTAL),'$999,999.90') AS "AMTDUE"
FROM
   VENDORS JOIN INVOICES ON vendors.vendor_id = invoices.vendor_id
GROUP BY vendor_name
having (INVOICE_TOTAL - (PAYMENT_TOTAL + CREDIT_TOTAL)) > 0;

NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What would be the Mongodb equivalent of the 2 following SQL queries? SELECT A.Lname FROM Assistant...
What would be the Mongodb equivalent of the 2 following SQL queries? SELECT A.Lname FROM Assistant A INNER JOIN Manager Ma ON A.RefNum = Ma.RefNum GROUP BY A.Lname HAVING COUNT(DISTINCT Ma.Manager) > 1; SELECT G.Cname, R.Snum FROM Game G INNER JOIN Role R ON G.Cnum = R.Cnum WHERE G.level>200;
Customers ID Name Street City Zip email 1 Emily 101 Anza St San Francisco 94118 2...
Customers ID Name Street City Zip email 1 Emily 101 Anza St San Francisco 94118 2 Amy 1 Houston Ave New York 12111 3 John 29 Sunset Blvd Los Angeles 45643 4 Pam 800 Market St San Francisco 94080 5 Sue 400 Muir Ave Redwood City 94598 6 Chris 987 A Ave New York 13111 7 Todd 788 Harrison St San Francisco 94117 Products ID Product_name Price Quantity 1 Metal pen 5.99 20 2 Surge protector 25.99 0 3 pencil...
1) In which clause of a query can a subquery not be used? (Choose two.) 2)...
1) In which clause of a query can a subquery not be used? (Choose two.) 2) The ORDER BY clause is allowed in an inline view true or false 3) the order by clause is not allowed in subqueries true or false 4) The operators IN and EXISTS are somewhat equivalent true or false 5) this Oracle error message? ORA-01427: single- row subquery returns more than one row >= = IN <= 6) SELECT 'TRUE' FROM dual WHERE 6 =...
1. Write a SELECT statement to count SKUs for each department, i.e., a table of two...
1. Write a SELECT statement to count SKUs for each department, i.e., a table of two columns, departments and their SKU counts. use cape_codd; select department, count(*) from sku_data group by department ; 2. List buyers who is responsible for at least two SKUs, in three columns, department, buyer, sku count. Sort buyers by their department names in ascending order. select department, buyer, count(sku) from sku_data group by buyer ; 3. Write a SQL statement which returns all the orders....
x y 0 6 1 5 2 3 3 1 4 0 A) From the above...
x y 0 6 1 5 2 3 3 1 4 0 A) From the above table, calculate the predicted value of y for x0=5. B) Calculate the standard error of the forecast error. C) Calculate a 95% confidence interval of y given x0=5
Lab 5 Queries with Multiple Tables In this lab, we do queries more than one table....
Lab 5 Queries with Multiple Tables In this lab, we do queries more than one table. SQL provides two different techniques for querying data from multiple tables: • The SQL subquery • The SQL join As you will learn, although both work with multiple tables, they are used for slightly different purposes. We used WMCRM database which is what we created in Lab 4. Here is the summary of the database schema (where schema is used in its meaning of...
1)   If 67+3?(?)+4?^2(?(?))^3=0 and ?(−4)=−1, find ?′(−4).      f'(-4)= 2)   Find an equation of the tangent...
1)   If 67+3?(?)+4?^2(?(?))^3=0 and ?(−4)=−1, find ?′(−4).      f'(-4)= 2)   Find an equation of the tangent line to the curve ?^2=?^3(5−?) (a piriform) at the point (1,2). The equation of this tangent line can be written in the form ?=??+?, where ?=_________ and ?=________ find m and b
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6...
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6 1 5 6 8 2 4 6 7 3 4 5 9 10 5 8 9 4 7 9 6 7 8 6 How can I detect when 'cin' starts reading from a new line. The amount of numbers in each row is unknown. I need them in type 'int' to use the data. Also, it will be executed like so, "./a.out < sampleInput.txt".
The following data were used in a regression study. Observation 1 2 3 4 5 6...
The following data were used in a regression study. Observation 1 2 3 4 5 6 7 8 9 xi 2 3 4 5 7 7 7 8 9 yi 3 5 4 7 4 6 9 4 11 (a) Develop an estimated regression equation for these data. (Round your numerical values to two decimal places.) ŷ = (b) Construct a plot of the residuals. A residual plot has 9 points plotted on it. The horizontal axis ranges from 0...
Class-In Assignment 3: Chapters 4&5 How to retrieve data from two or more tables Exercises 1....
Class-In Assignment 3: Chapters 4&5 How to retrieve data from two or more tables Exercises 1. Write a SELECT statement that returns all columns from the Vendors table inner-joined with all columns from the Invoices table. 2. Write a SELECT statement that returns four columns: vendor_name vendor_name from the Vendors table invoice_number invoice_number from the Invoices table invoice_date invoice_date from the Invoices table balance_due invoice_total minus payment_total minus credit_total from the Invoices table The result set should have one row...