Question

write a SQL query for: For each product that was sold in more than one sales...

write a SQL query for: For each product that was sold in more than one sales transaction, retrieve the ProductID value and the number of sales transactions in which the product was sold.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer is as follows :

SELECT ProductId, Sales AS Number_of_sales FROM Products WHERE COUNT(sales_transaction) > 1 ;

Here ProductId and Number of sales from sales attrbute are retrieve from the table Products where count of sales trasaction is more than 1.

I will assume the table name to Products and column name sales where I can fetch sales numbers, you can provide here your table name and column name.

if there is any query please ask in comments...

Add a comment
Know the answer?
Add Answer to:
write a SQL query for: For each product that was sold in more than one sales...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a sql query that returns Which states have more than one customer? List the states and the ...

    write a sql query that returns Which states have more than one customer? List the states and the number of customers for those states. The list must not include the states that do not have more than one customer. CUSTOMER_T CustomerName, Street, City, State, Zip,

  • For each question, write a SQL query and save it as a "sql" file using a...

    For each question, write a SQL query and save it as a "sql" file using a different query 2, etc. Please execute these queries sequentially name, for example, query1.query product id (PK) category brand production_cost (Not Null) (FK) name (Not Null) Toothpaste Supermarket 1 Multivitami Supermarket 2 Shampoo acket T-shirt Supplements Supermarket Department4 Department5 Pharmacy Pharmacy 6 6 10 Query1. Update the Product table by adding another column as shown above ucts (name) with uery2. Retrieve all the uction cost...

  • 2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query...

    2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query the following Hotel Room Booking Database Tables. "cid" is Customer ID. "rid" is Room ID. "bid" is Booking ID. "dob" means Date of Vwwww Birth; "beds" means the number of beds in the room which is normally 1 or 2 beds. "DueDate" and "DueAmount" are the payment due dates and due amounts of this booking. Customers fname name phone email cid dob zipcode Rooms...

  • I need to write an SQL statement to run this query: SALES has the following column...

    I need to write an SQL statement to run this query: SALES has the following column names: vendorid, name, upc, move, price, qty, year, store the table name is SALES... the sales is not a column in the SALES so it needs to be created in the query with the formula as well. QUESTION BELOW: Query 4: Return the vendor id, vendor name, product UPC code, move, and sales (price * move/qty) for each product sold by store 100 in...

  • 7. Using the provided schema of a Purchase Order Administration database, write the following queries in...

    7. Using the provided schema of a Purchase Order Administration database, write the following queries in SQL. (In the schema, bold attributes are primary keys and italicized attributes are foreign keys.) SUPPLIER (SUPNR, SUPNAME, SUPADDRESS, SUPCITY, SUPSTATUS) SUPPLIES (SUPNR, PRODNR, PURCHASE_PRICE, DELIV_PERIOD) PRODUCT (PRODNR, PRODNAME, PRODTYPE, AVAILABLE_QUANTITY) PO_LINE (PONR, PRODNR, QUANTITY) PURCHASE_ORDER (PONR, PODATE, SUPNR) 7d) Write a nested SQL query to retrieve the supplier number, supplier name, and supplier status of each supplier who has a higher supplier status...

  • SQL query: Write a SQL statement using the employees table and retrieve employees whose monthly salary...

    SQL query: Write a SQL statement using the employees table and retrieve employees whose monthly salary (including their commission) is greater or equal to 5,000 but less than or equal to 17,000 (we are assuming the salary on the table is monthly). In other words, if their monthly salary was 1000 and their commission was .2, their total monthly salary would be 1200 and given the criteria above this instance would not be selected. Please display the full name of...

  • Write a SQL query that shows the price of each order made by customers whose last name starts wit...

    Write a SQL query that shows the price of each order made by customers whose last name starts with the letter M. Display the order number, the last name on the order, and the price of the order (Order Price). Show the results with the highest order price first. Write a SQL query that determines the most expensive item purchased in each order (Item Price). Display the order number, the date of the order, the last name of the customer...

  • WRITE A SQL QUERY SQL SERVER Write a SELECT statement that returns one column from the...

    WRITE A SQL QUERY SQL SERVER Write a SELECT statement that returns one column from the Customers table named FullName that joins the LastName and FirstName columns. --       Format this column with the last name, a comma, a space, and the first name like this: --       Doe, John --       Sort the result set by last name in ascending sequence. --       Return only the contacts whose last name begins with a letter from M to Z. --  ...

  • Currently working in SQL For each manufacturerID, what is the least expensive product price? Display the...

    Currently working in SQL For each manufacturerID, what is the least expensive product price? Display the manufacturerID as well as a column with the alias LeastExpensiveShoe. Sort the results from least expensive to most expensive. This query does not require the JOIN clause. Product ProductID ProductName ManufacturerlD Category Color Price Description Manufacturer ManufacturerID ManufacturerName Address City State PostalCode Phone

  • Write an SQL query to list those properties that have never been sold. Design Tip When a property has sold, its information can be found in Sales table and vice versa. List each property with the foll...

    Write an SQL query to list those properties that have never been sold. Design Tip When a property has sold, its information can be found in Sales table and vice versa. List each property with the following four columns: property_id, primary_purpose, locality, and the area. Name the area coulmn as "Area". (Since the dataset might be incomplete, return "N/A" when the area is unknown for a property.) So the problem I got is that I got very similar output as...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT