[프로그래머스][MySQL] NULL 처리하기
·
데이터베이스/문제 풀이
http://school.programmers.co.kr/learn/courses/30/lessons/59410 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr select animal_type, ifnull(name, 'No name') as name, sex_upon_intakefrom animal_ins
[프로그래머스][MySQL] 이름에 el이 들어가는 동물 찾기
·
데이터베이스/문제 풀이
https://school.programmers.co.kr/learn/courses/30/lessons/59047 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krselect animal_id, namefrom animal_inswhere animal_type = 'Dog' and name like '%el%'order by name asc, animal_id asc; LIKE 'el%'el로 시작el, ella, elementLIKE '%el'el로 끝남el, labelLIKE '%el%'el이 포함됨el, hello, ellaLIKE 'e%l'e로 시작하고 l로 끝남el, emailLIKE '%e%l%'e가 나..
[프로그래머스][MySQL] 동명 동물 수 찾기
·
데이터베이스/문제 풀이
https://school.programmers.co.kr/learn/courses/30/lessons/59041 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr select name, count(*) as countfrom animal_inswhere name is not nullgroup by namehaving count(*) >= 2order by name asc
[프로그래머스][MySQL] 최솟값 구하기
·
데이터베이스/문제 풀이
https://school.programmers.co.kr/learn/courses/30/lessons/59038 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr시간 중 최소select min(datetime)from animal_ins 오름차순 정렬 후 1번select datetimefrom animal_insorder by datetime asclimit 1;
[프로그래머스][MySQL] 중복 제거하기
·
데이터베이스/문제 풀이
https://school.programmers.co.kr/learn/courses/30/lessons/59408 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krselect count(*) as countfrom (select namefrom animal_inswhere name is not nullgroup by name) as name_groupWHERE 절로 NULL 이름 제거→ GROUP BY로 중복된 이름을 하나로 묶기→ FROM 절의 서브쿼리에 별칭 필수(name_group) 지정→ 바깥 쿼리에서 결과 행의 개수 계산
[프로그래머스][MySQL] 특정 형질을 가지는 대장균 찾기
·
데이터베이스/문제 풀이
https://school.programmers.co.kr/learn/courses/30/lessons/301646 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr형질은 각 비트로 표현된다.1번 형질: 1 → 00012번 형질: 2 → 00103번 형질: 4 → 0100& 연산은 두 값에서 같은 위치의 비트가 모두 1일 때만 해당 비트를 남긴다. -> 0001 & 0001 = 0001 , 0001 & 1110 = 0000따라서 (genotype & 2) = 2이면 2번 형질을 가진 것이고, (genotype & 2) != 2이면 2번 형질이 없는 것이다.같은 방식으로 genotype & 1은 1번 형질, geno..