[프로그래머스][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
JPA ddl-auto 대신 Flyway로 DB 스키마 관리해보기
·
프로젝트
ddl-autoJPA 구현체인 Hibernate가 테이블 생성/검증/수정에 얼마나 관여할지 정하는 설정.ddl-auto 설정 종류create - 애플리케이션 시작 시 기존 테이블 등의 스키마 객체를 삭제하고, Entity를 기준으로 다시 생성한다.create-drop - 애플리케이션 시작 시 기존 스키마 객체를 삭제하고 다시 생성하며, 애플리케이션이 정상 종료될 때 다시 삭제한다.update - Entity 매핑을 기준으로 DB 스키마 변경을 시도한다. 변경 이력이 남지 않으며, 모든 변경을 안전하게 처리한다고 보장할 수는 없다.validate - Entity 매핑에 필요한 테이블과 컬럼 등이 DB 구조와 호환되는지 검증한다. 문제가 있으면 애플리케이션 실행에 실패한다.none - Hibernate가 D..
[프로그래머스][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) 지정→ 바깥 쿼리에서 결과 행의 개수 계산