Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- Window Function
- 서브쿼리
- MySQL
- SQL코테
- nlp논문
- SQL 날짜 데이터
- sql
- update
- leetcode
- 표준편차
- 그룹바이
- 짝수
- NLP
- airflow
- CASE
- 자연어 논문
- GRU
- 논문리뷰
- 코딩테스트
- 자연어처리
- 설명의무
- sigmoid
- torch
- HackerRank
- Statistics
- t분포
- 카이제곱분포
- LSTM
- 자연어 논문 리뷰
- inner join
Archives
- Today
- Total
HAZEL
[SQL : Leetcode] LEFT JOIN 문 본문
1. 183. Customers Who Never Order
>> 문제
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything.
Table: Customers.
+----+-------+
| Id | Name |
+----+-------+
| 1 | Joe |
| 2 | Henry |
| 3 | Sam |
| 4 | Max |
+----+-------+
Table: Orders.
+----+------------+
| Id | CustomerId |
+----+------------+
| 1 | 3 |
| 2 | 1 |
+----+------------+
Using the above tables as example, return the following:
+-----------+
| Customers |
+-----------+
| Henry |
| Max |
+-----------+
>> 문제 푼 코드
SELECT CUSTOMERS.NAME AS Customers
FROM CUSTOMERS
LEFT JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CustomerId
WHERE ORDERS.CUSTOMERID IS NULL
leetcode.com/problems/customers-who-never-order/
'DATA ANALYSIS > SQL' 카테고리의 다른 글
[SQL : HackerRank] UNION (0) | 2021.02.14 |
---|---|
[SQL : HackerRank/Leetcode] SELF JOIN (0) | 2021.02.13 |
[SQL : HackerRank/Leetcode] INNER JOIN (0) | 2021.02.12 |
[SQL : GROUP BY/ where 서브쿼리 ] HackerRank: Top Earners (0) | 2021.02.12 |
[SQL : HackerRank/Leetcode] CASE 문 (0) | 2021.02.08 |