Company: oracle_29oct
Difficulty: medium
Problem Description To monitor pricing trends, a company wants to identify products that have experienced a significant price increase. Write a query to find all products whose most recent price is more than 50% higher than their historical average price. Schema Table: products id (INT, PRIMARY KEY): Unique identifier for a product. name (VARCHAR(255)): Name of the product. brand (VARCHAR(255)): Brand of the product. Table: price_history id (INT, PRIMARY KEY): Unique identifier for the price record. product_id (INT, FOREIGN KEY to products.id ): The product associated with the price change. price (DECIMAL(10,2)): The recorded price of the product. changed_at (DATE): The date when the price was updated. Required Output Your query should return the following columns in this exact order: product_id — Unique identifier for the product. name — Name of the product. current_price — The most recently recorded price for the product. average_price — The historical average