With

    [DB/SQL] With절을 사용하여 임시 테이블 생성하기

    다음과 같이 쿼리문이 있을 때, SubQuery가 많아 복잡해보입니다. 여기서 계속 SubQuery가 붙으면 알아보기에도 어려울 것입니다. select c.title, b.cnt_checkins, a.cnt_total, (b.cnt_checkins/a.cnt_total) as ratio from ( select course_id, count(*) as cnt_total from orders group by course_id ) a inner join ( select course_id, count(distinct(user_id)) as cnt_checkins from checkins group by course_id ) b on a.course_id = b.course_id inner join course..

    [코틀린 인 액션] 5장 정리

    5.1.2 람다와 컬렉션 1. 라이브러리 함수를 사용하여 프로퍼티를 비교해 값이 가장 큰 원소 찾기 // 루프 사용 class Person(val name: String, val age: Int) fun main(args: Array) { val people = listOf(Person("Alice", 29), Person("Bob", 31)) findTheOldest(people) } fun findTheOldest(people: List) { var maxAge = 0 var theOldest: Person? = null for (person in people) { if (person.age > maxAge) { maxAge = person.age theOldest = person } } printl..