Question

In: Computer Science

1. For each vendor display the vendor name, sum of all orders as Total Value and...

1. For each vendor display the vendor name, sum of all orders as Total Value and the number of orders placed as # Orders. Hint you must calculate the total amount for each order based upon unit price and number of units ordered. Write SQL Query

2.    Display the name of vendors who have supplied at least one order to every event.   Hint this query will require nested correlated subqueries using the not exists operator. Write SQL query

Solutions

Expert Solution


[A]
SELECT T1.vendorname, T1.TOTAL AS "Total Value", T2.TOTAL AS "Orders"
FROM
(
SELECT vendorname, sum(unitprice * numberofunits) AS TOTAL
FROM <table name>
group by vendor name
) T1
JOIN
(
SELECT vendorname, sum(number of orders placed) AS TOTAL
FROM <table name>
group by vendor name
) T2
ON (T1.vendorname = T2.vendorname);  

[B]
SELECT vendorname
FROM <table name>
WHERE vendorID not exists ( SELECT vendorID
FROM <table name>
GROUP BY vendorID
Having count<orderID> < 1
)
  
  
  
  


Related Solutions

1. A retailer orders eight products from a single vendor. Assume that the demand for each...
1. A retailer orders eight products from a single vendor. Assume that the demand for each product is deterministic, and is given below. The major fixed ordering cost is estimated to be $8; that is, the cost for the first item on the purchase order is $8. It costs $1 to add additional products to the purchase order. The carrying charge has been established as 0.30 $/$/year. Item Demand (Units/Year) vi ($/Unit) 1 600 2.50 2 200 12.65 3 350...
Problem 44 Write a query to display the employee number, last name, first name, and sum...
Problem 44 Write a query to display the employee number, last name, first name, and sum of invoice totals for all employees who completed an invoice. Sort the output by employee last name and then by first name (Partial results shown in Figure P7.44).
A pizza delivery vendor has a goal of delivering all orders within 50 minutes. A sample...
A pizza delivery vendor has a goal of delivering all orders within 50 minutes. A sample was taken and found a mean of 40 minutes and a sample standard deviation of 6 minutes. Assuming the distribution is normal, what percent of the population did not meet the goal of 50 minutes?
Get all homework scores for one student, calculate and display the sum of the scores, and...
Get all homework scores for one student, calculate and display the sum of the scores, and also display the word “fail” if the sum is lower than 150. Note: we do not know how many homework scores each student will enter. Ask the user how many homework scores there are at the beginning. Then, ask for a homework score at a time, for as many times as indicated by the user. C++
1. Write a bash command that will display the value of all environment variables defined in...
1. Write a bash command that will display the value of all environment variables defined in your shell process, sorted in alphabetical order, and numbered. Here is a sample of the type of output your command should produce: 1 } 2 ALSA_CONFIG_PATH=/etc/alsa-pulse.conf 3 AUDIODRIVER=pulseaudio 4 BASH_FUNC_mc%%=() { . /usr/share/mc/mc-wrapper.sh 5 COLORTERM=1 2. Write a bash command that will display the value (and only the value) of the JAVA_ROOT environment variable. Here is a sample of the type of output your...
A bank's balance sheet equates the value of total assets to the sum of total liabilities...
A bank's balance sheet equates the value of total assets to the sum of total liabilities and equity capital. (T/F) Negotiable certificates of deposit (CDs) do not have an active secondary market. (T/F) In a bankruptcy situation, the Federal Reserve acts as the liquidator of the bank. (T/F) International expansion for financial institutions coming from highly integrated countries maximizes the risk diversification. (T/F) The financial crisis of 2008, demonstrated that activities such as trading in financial futures and interest-rate swaps...
Create a report that lists customers with the total value of their orders from the database....
Create a report that lists customers with the total value of their orders from the database. Each row of the table should list the customer name and the total value of all orders. Rows should be in descending order according to the total. Just list the first 5 customers, those with the highest total orders. This part is more complex and, so, can be approached in many ways. You may decide to use simple queries and put the information together...
1)With​ two-way ANOVA, the total sum of squares is portioned in the sum of squares for​...
1)With​ two-way ANOVA, the total sum of squares is portioned in the sum of squares for​ _______. 2) A​ _______ represents the number of data values assigned to each cell in a​ two-way ANOVA table. a)cell b) Block c)replication D)level 3.) True or false: In a​ two-way ANOVA​ procedure, the results of the hypothesis test for Factor A and Factor B are only reliable when the hypothesis test for the interaction of Factors A and B is statistically insignificant. 4.)Randomized...
The present value of an annuity is the sum of the discounted value of all future cash flows.
Present value of annuities and annuity paymentsThe present value of an annuity is the sum of the discounted value of all future cash flows.You have the opportunity to invest in several annuities. Which of the following 10-year annuities has the greatest present value (PV)? Assume that all annuities earn the same positive interest rate.An annuity that pays $500 at the end of every six monthsAn annuity that pays $1,000 at the beginning of each yearAn annuity that pays $500 at...
Design and implement an application that reads an integer value and prints the sum of all...
Design and implement an application that reads an integer value and prints the sum of all even integers between 2 and the input value, inclusive. Print an error message if the input value is less than 2 and prompt accordingly so that the user can enter the right number. Your program file will be called YourLastNameExamQ2
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT