서브쿼리

1. 문제 We define an employee's total earnings to be their monthly salary x months worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings for all employees as well as the total number of employees who have maximum total earnings. Then print these values as 2 space-separated integers. The Emplo..
*FROM절, WHERE절에서 사용하는 서브쿼리 : 가상의 테이블을 하나 더 만든다라고 생각 Task : 각 주의 평균 범죄발생을 COUNT 매일 범죄가 몇번 발생했는지를 파악(서브쿼리) -> 컬럼(week, date, incident_daily) 결과물 : (2+1+3+1+1+1+2)/7 -> 만약 2020-01-06에 범죄가 일어나지 않아서 nan값일때는 서브쿼리가 2020-01-06의 incident_daily를 계산하지 않기 때문에 (2+3+1+1+1+2)/6으로 계산이 됨. 하지만 우리는 2020-01-06의 incident_daily를 0건으로 놓고 계산하고 싶은 것이기 때문에 사실상 계산은 (2+0+3+1+1+1+2)/7로 계산이 되어야한다는 점에 유의할 것! -> 평균, 날짜함수를 사용할 ..
xod22
'서브쿼리' 태그의 글 목록