트랜잭션에서 일관된 날짜 다루기
Idaho 현장 사무소에서 다시 요청이 왔습니다. 우리가 분석해 온 Minidoka 카운티의 시험 지점 13903과 Ada 카운티의 지점 11643 사이에서, 가장 최근 10개 샘플이 어떻게 비교되는지 확인하고 싶어 합니다.
이 연습은 강의의 일부입니다
Redshift 입문
연습 안내
- 트랜잭션을 시작하세요.
- 동일한 타임스탬프를 얻기 위한 올바른 함수를 사용하고, 두 개의 SELECT 문을 모두 올바르게 종료하세요.
- 트랜잭션을 종료하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
--Open the Transaction
___
SELECT *, CAST(sample_date AS DATE) as date_sampled
FROM public_intro_redshift.idaho_samples
WHERE fk_monitoringlocation = 13903
-- Use the consistent timestamp function
AND CAST(sample_date AS DATE) < ___
ORDER BY date_sampled DESC
-- Add the statement terminator
LIMIT 10___
SELECT *, CAST(sample_date AS DATE) as date_sampled
FROM public_intro_redshift.idaho_samples
WHERE fk_monitoringlocation = 11643
-- Use the consistent timestamp function
AND CAST(sample_date AS DATE) < ___
ORDER BY date_sampled DESC
-- Add the statement terminator
LIMIT 10___
-- Close the transaction
___