Ultimate access to all questions.
A data engineer needs to extract the date part from the order_timestamp
column in the orders
Delta table, formatting it as '31-12-2022', where the first two digits represent the day of the month, followed by the month of the year, and finally the year itself, all separated by hyphens. Which query should the data engineer use to achieve this?
Explanation:
The date_format()
function converts a timestamp to a string in the specified format. The correct format for the desired output 'dd-MM-YYYY' uses 'dd' for the day of the month, 'MM' for the month of the year, and 'YYYY' for the year, all separated by hyphens. The correct query is: SELECT order_id, date_format(order_timestamp, ‘dd-MM-YYYY‘) as order_date FROM orders;
. For more details on datetime patterns, refer to the Datetime patterns documentation.