MulaiMulai sekarang secara gratis

Using CURRENT_TIMESTAMP

Another common question in analytical queries is finding data within a certain interval of the current date or time. Although the dates in our data are in the past, you will often work with tables that have data being updated daily or even with data streaming in.

Latihan ini adalah bagian dari kursus

Introduction to BigQuery

Lihat Kursus

Petunjuk latihan

  • Complete the query to find the difference in days from the current day for the first five orders using the DATE_DIFF() function.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

-- Finish the query to find the difference in days

SELECT
	-- Add in the function to find the difference between two dates
	___(
      -- Finish the statement with the correct date part
      EXTRACT(___ FROM order_purchase_timestamp),
      -- Add the function to find the current date
      ___(),
      DAY
    )
FROM 
	ecommerce.ecomm_order_details
LIMIT 5;
Edit dan Jalankan Kode