Interview Query

Product Average

0
Have you seen this question before?

Given a table of transactions and products, write a query to return the product id, product price, and average transaction total value (price*quantity) of each product with a price greater than the average transaction price.

Example:

Input:

transactions table

Column Type
id INTEGER
user_id INTEGER
created_at DATETIME
product_id INTEGER
quantity INTEGER

products table

Column Type
id INTEGER
name VARCHAR
price FLOAT
Next question: Merge N Sorted Lists
.....
MySQL 8.0.17
Loading editor
Use Shift + Enter to run query