본문 바로가기
데이터분석/TIL

240807 TIL

by Freely_ 2024. 8. 7.
728x90
반응형

Products 테이블

Write a solution to find the ids of products that are both low fat and recyclable.
Return the result table in any order.
The result format is in the following example.

 

저지방이면서 재활용이 가능한 제품의 ID를 찾아 결과표를 순서에 상관없이 반환

 

  • 풀이
SELECT product_id
FROM products
WHERE low_fats = 'Y' AND recyclable = 'Y'

Customer 테이블

 

Find the names of the customer that are not referred by the customer with id = 2.
Return the result table in any order.
The result format is in the following example.

 

ID가 2인 고객을 제외한 고객 이름 조회, 순서에 상관없이 반환

 

  • 풀이
SELECT name
FROM customer
WHERE referee_id not like '2' or referee_id is null

World 테이블

 

A country is big if:
it has an area of at least three million (i.e., 3000000 km2), or
it has a population of at least twenty-five million (i.e., 25000000).
Write a solution to find the name, population, and area of the big countries.
Return the result table in any order.
The result format is in the following example.

 

최소 300만의 면적을 가지고 있거나 최소 2,500만 명의 인구인 나라의 이름, 인구, 면적 조회

 

  • 풀이
SELECT name, population, area
FROM world
WHERE area >= 3000000 or population >= 25000000
728x90
반응형

'데이터분석 > TIL' 카테고리의 다른 글

240808 TIL  (0) 2024.08.08
240806 TIL  (0) 2024.08.06
240731 TIL  (0) 2024.07.31