開始使用免費開始

在同一筆交易中維持一致的日期時間

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       
___
編輯並執行程式碼