728x90
1757. Recyclable and Low Fat Products
SELECT product_id
FROM Products
WHERE low_fats = 'Y' AND recyclable = 'Y';
584. Find Customer Referee
SELECT name
FROM Customer
WHERE NOT referee_id = 2 OR referee_id IS NULL;
595. Big Countries
SELECT name, population, area
FROM World
WHERE area >= 3000000 OR population >= 25000000;
1148. Article Views 1
SELECT DISTINCT author_id AS id
FROM Views
WHERE author_id = viewer_id
ORDER BY author_id;
1683. Invalid Tweets
SELECT tweet_id
FROM Tweets
WHERE LENGTH(content) > 15;
1378. Replace Employee Id With The Unique Identifier
SELECT B.unique_id, A.name
FROM Employees A LEFT JOIN EmployeeUNI B ON A.id = B.id;
1068. Product Sales Analysis 1
SELECT b.product_name, a.year, a.price
FROM Sales a JOIN Product b ON a.product_id = b.product_id;
1581. Customer Who Visited but Did Not Make Any Transactions
SELECT a.customer_id, COUNT(a.customer_id) AS count_no_trans
FROM Visits a LEFT JOIN Transactions b ON a.visit_id = b.visit_id
WHERE b.visit_id IS NULL
GROUP BY a.customer_id;
728x90
'코테 > SQL' 카테고리의 다른 글
| [Programmers] 물고기 종류 별 대어 찾기 (MYSQL) (0) | 2024.03.21 |
|---|---|
| [Programmers] 부서별 평균 연봉 조회하기 (MYSQL) (1) | 2024.03.20 |
| [Programmers] PCSQL 샘플문제 4번 (MYSQL) (0) | 2024.02.02 |
| [Solvesql] 실전반 무료 문제 풀이 (SQLite) (1) | 2024.02.02 |
| [Solvesql] 입문반 무료 문제 풀이 (SQLite) (1) | 2024.01.28 |