✔✔✔simple solution with simple explanation - PANDAS
Code\n\nimport pandas as pd\n\ndef sales_analysis(sales: pd.DataFrame, product: pd.DataFrame) -> pd.DataFrame:\n    # Merge sales and product tables\n    merged
# Code\n```\nimport pandas as pd\n\ndef sales_analysis(sales: pd.DataFrame, product: pd.DataFrame) -> pd.DataFrame:\n    # Merge sales and product tables\n    merged_df = sales.merge(product, how=\'left\', on=\'product_id\')\n    \n    # Find the first year of sale for each product\n    first_year_df = merged_df.groupby(\'product_id\')[\'year\'].min().reset_index()\n    \n    # Merge the first year information back to the merged dataframe to get the corresponding quantity and price\n    result_df = first_year_df.merge(merged_df, how=\'inner\', on=[\'product_id\', \'year\']).rename(columns = {\'year\' : \'first_year\'})\n    \n    return result_df[[\'product_id\', \'first_year\', \'quantity\', \'price\']]\n```
['Database', 'Pandas']