cte sql
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nthink of cte and then t
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nthink of cte and then try to get the link between main table through join\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\no(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n0(n)\n# Code\n```\n# Write your MySQL query statement below\nselect product_id , year as first_year,quantity, price from sales where (product_id,year )in\n(\nselect product_id,min(year) as year from sales group by product_id\n)\n\n\n```
['Database', 'C++', 'MySQL', 'Pandas']