始める無料で始める

トランザクション内で一貫した日付

アイダホ州の現地オフィスから再び依頼があり、これまで分析してきたミニドーカ郡の試験サイト 13903 の直近10件のサンプルと、エイダ郡のサイト 11643 のデータを比較したいとのことです。

この演習はコースの一部です

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       
___
コードを編集して実行