开始使用免费开始使用

在事务中保持一致的日期

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       
___
编辑并运行代码