Company: Zomato_product_Analyst
Difficulty: medium
Problem Description Write a SQL query to identify the user (or users) who generated the highest total recognized revenue in July 2021. The revenue calculated for each transaction depends on the operation_type performed: If the operation is a 'buy' , 100% of the transaction amount is counted as revenue. If the operation is a 'sell' , 10% of the transaction amount is counted as revenue. Additionally, the transaction status determines if the revenue is recognized at all: 'completed' : The calculated revenue is fully recognized. 'pending' or 'cancelled' : The transaction contributes 0 to the recognized revenue. Schema Table: transactions transaction_id (INT): Primary key for the transaction. user_id (INT): Identifier for the user performing the transaction. transaction_date (DATE): The date the transaction occurred. operation_type (VARCHAR): The type of operation, either 'buy' or 'sell' . status (VARCHAR): The state of the transaction, one of 'completed' , 'pending' , or 'cancelled' . amou