SQL

[중급 SQL 문제풀이] leetcode 문제 및 풀이(1)

은듀 2022. 1. 10. 15:17
반응형

알고리즘 문제 및 풀이사이트

https://leetcode.com/

 

LeetCode - The World's Leading Online Programming Learning Platform

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

 

sql 문제풀이 

  1. Leetcode 595. Big Countries: https://leetcode.com/problems/big-countries/
  2. Leetcode 620. Not Boring Movies: https://leetcode.com/problems/not-boring-movies/
  3. Leetcode 182. Duplicate  Emails: https://leetcode.com/problems/duplicate-emails/
  4. Leetcode 175. Combine Two Tables: https://leetcode.com/problems/combine-two-tables/

 

 

 

 

 

 

- 답안

Leetcode 595

SELECT name, population, area FROM World
WHERE area >= 3000000 
OR population >= 25000000

Leetcode 620

select id, movie, description, rating 
from Cinema
WHERE id%2 =1 #홀수 판별
AND description !='boring'
order by rating desc

Leetcode 182

 #중복이메일 찾기

SELECT email #,count(*) 
FROM Person
GROUP BY email
having count(*) > 1

Leetcode 175

SELECT P.firstName, P.lastName , A.city, A.state
FROM Person P
LEFT JOIN Address A
on P.personId = A.personId