본문 바로가기

Database7

[프로그래머스] SQL 고득점 Kit - 중성화 여부 파악하기 (MySQL) 문제 및 풀이 문제) 프로그래머스 - SQL - 중성화 여부 파악하기 https://programmers.co.kr/learn/courses/30/lessons/59409 코딩테스트 연습 - 중성화 여부 파악하기 ANIMAL_INS 테이블은 동물 보호소에 들어온 동물의 정보를 담은 테이블입니다. ANIMAL_INS 테이블 구조는 다음과 같으며, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE는 각각 동물의 아이디 programmers.co.kr like문을 활용해 Neutured나 Spayed가 포함된 동물에 중성화 여부를 삼항 연산자를 이용해 표시합니다. 풀이) SELECT ANIMAL_ID, NAME, if(SEX_UPON_INTA.. 2021. 12. 30.
[Leetcode] 596. Classes More Than 5 Students (MySQL) 문제 및 풀이 문제) Leetcode - SQL - Classes More Than 5 Students https://leetcode.com/problems/classes-more-than-5-students/ Classes More Than 5 Students - LeetCode 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 학생 수가 5명 이상인 수업을 고르는 문제였습니다. group by를 통해 수업 별로 묶은 후, count를 통해 학생 수를 계산합니다. 풀이) select class.. 2021. 12. 30.
[Leetcode] 620. Not Boring Movies (MySQL) 문제 및 풀이 문제) Leetcode - SQL - Not Boring Movies https://leetcode.com/problems/not-boring-movies/ Not Boring Movies - LeetCode 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 풀이) select * from Cinema where mod(id,2) = 1 and description != "boring" order by rating desc 2021. 12. 23.
[Leetcode] 595. Big Countries (MySQL) 문제 및 풀이 문제) Leetcode - SQL - Big Countries https://leetcode.com/problems/big-countries/ Big Countries - LeetCode 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 면적이 300000 이상, 인구수가 25000000 이상인 국가를 찾는 문제였습니다. select, from, where 문으로 쉽게 해결할 수 있는 문제였습니다. 풀이) select w.name, w.population, w.area from W.. 2021. 12. 22.
[Leetcode] 183. Customers Who Never Order (MySQL) 문제 및 풀이 문제) Leetcode - Join - Customers Who Never Order https://leetcode.com/problems/customers-who-never-order/ Customers Who Never Order - LeetCode 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 customer 테이블에서 order 테이블에 존재하지 않는 name을 찾는 문제였습니다. customer 테이블과 order 테이블을 left join 한 후에 where문으로 o.. 2021. 12. 16.
[프로그래머스] SQL 고득점 Kit - 오랜 기간 보호한 동물(1) (MySQL) 문제 및 풀이 문제) 프로그래머스 - JOIN - 오랜 기간 보호한 동물(1) https://programmers.co.kr/learn/courses/30/lessons/59044 코딩테스트 연습 - 오랜 기간 보호한 동물(1) ANIMAL_INS 테이블은 동물 보호소에 들어온 동물의 정보를 담은 테이블입니다. ANIMAL_INS 테이블 구조는 다음과 같으며, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE는 각각 동물의 아이디 programmers.co.kr 입양을 못 간 동물을 조회해야 하므로 ANIMAL_INS에만 존재하는 동물을 조회해야 합니다. 보호 시작일 순으로 조회해야 하기 때문에 order by를 적용하고, 3마리만 출력.. 2021. 12. 13.
[Leetcode] 182. Duplicate Emails (MySQL) 문제 및 풀이 문제) Leetcode - SQL - Duplicate Emails https://leetcode.com/problems/duplicate-emails/ Duplicate Emails - LeetCode 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 중복된 이메일을 찾는 문제였습니다. Group by로 email 별로 묶은 후, count(email)을 통해 개수가 1이 아닌 것을 출력했습니다. 풀이) select email from Person group by email ha.. 2021. 12. 12.
반응형