MulaiMulai sekarang secara gratis

Formatting dates

Eve from the Business Intelligence (BI) team lets you know that she's gonna need your help to write queries for reports. The reports are read by C-level execs, so they need to be as readable and quick to scan as possible. Eve tells you that the C-level execs' preferred date format is something like Friday 01, June 2018 for 2018-06-01.

You have a list of useful patterns.

Pattern Description
DD Day number (01 - 31)
FMDay Full day name (Monday, Tuesday, etc.)
FMMonth Full month name (January, February, etc.)
YYYY Full 4-digit year (2018, 2019, etc.)

Figure out the format string that formats 2018-06-01 as "Friday 01, June 2018" when using TO_CHAR.

Latihan ini adalah bagian dari kursus

Analyzing Business Data in SQL

Lihat Kursus

Petunjuk latihan

  • Select the order date.
  • Format the order date so that 2018-06-01 is formatted as Friday 01, June 2018.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

SELECT DISTINCT
  -- Select the order date
  ___,
  -- Format the order date
  ___(___, ___) AS format_order_date
FROM orders
ORDER BY order_date ASC
LIMIT 3;
Edit dan Jalankan Kode