#81. [LeetCode / MySQL] 1068. Product Sales Analysis I

문제

 

입력 코드

1. 

SELECT P.product_name, S.year, S.price
FROM Sales AS S
  LEFT JOIN Product AS P
  ON S.product_id = P.product_id

 

2. 

SELECT P.product_name, S.year, S.price
FROM Sales AS S, Product AS P
WHERE S.product_id = P.product_id

 

3. 

SELECT P.product_name, S.year, S.price
FROM Sales AS S
JOIN Product AS P
USING (product_id)

 

코드 설명

#SELECT #JOIN #LEFT JOIN #WHERE #USING 

 

 

문제 출처

 

Product Sales Analysis I - LeetCode

Can you solve this real interview question? Product Sales Analysis I - Table: Sales +-------------+-------+ | Column Name | Type | +-------------+-------+ | sale_id | int | | product_id | int | | year | int | | quantity | int | | price | int | +-----------

leetcode.com