99.9k views
0 votes
Problems and Exercises 16 through 43 are based on the entire ("big" version) Pine Valley Furniture Company database. Note: Depending on what DBMS you are using, some field names may have changed to avoid using reserved words for the DBMS. When you first use the DBMS, check the table definitions to see what the exact field names are for the DBMS you are using. See the Preface and inside covers of . List the MaterialID, MaterialName, Material, MaterialStandardPrice, and Thickness for all raw materials made of cherry, pine, or walnut. Order the listing by Material, StandardPrice, and Thickness. Display the product ID and the number of orders placed for each product. Show the results in decreasing order by the number of times the product has been ordered and label this result column NumOrders.

User Mvsagar
by
6.4k points

1 Answer

2 votes

Answer:

SQL queries

The command used to display the customer ID and total number of orders placed is given below

Query:

SELECT CustomerID, COUNT (orderID) AS TotalOrders

FROM Order_Table

GROUP BY CustomerID

Step-by-step explanation:

SQL queries

The command used to display the customer ID and total number of orders placed is given below

Query:

SELECT CustomerID, COUNT (orderID) AS TotalOrders

FROM Order_Table

GROUP BY CustomerID

SELECT - To query the database and get back the specified fields SQL uses the select statement

CustomerID is a coloumn name

The function COUNT(OrderID) returns the number of orders

Totalorderds is a label

FROM - To query the database and get back the preferred information by specifying the table name

Order_Table is a table name

GROUP BY - The clause is used to group the result of a SELECT statement done on a table where the tuple values are similar for more than one column

The table below displays the CustomerID and total number of orders placed

CustomerID Totalorders

4 28

1 6

12 5

16 5

6 3

9 3

15 3

3 1

13 1

14 1

The table below shows the total number of orders situated for each sales person

SalesPerson_ID TotalOrders

3 16

2 3

4 3

5 3

User Hippo Fish
by
5.4k points