Aan de slagGa gratis aan de slag

Consistente datums in een transactie

Het field office in Idaho is er weer: ze willen zien hoe de laatste 10 monsters van testsite 13903 in Minidoka County, die we al analyseren, zich verhouden tot site 11643 in Ada County.

Deze oefening maakt deel uit van de cursus

Introductie tot Redshift

Cursus bekijken

Oefeninstructies

  • Open de transactie.
  • Gebruik de juiste functie om overal dezelfde timestamp te krijgen en sluit beide SELECT-statements correct af.
  • Sluit de transactie.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

--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       
___
Code bewerken en uitvoeren