Jonatan Spahn6,362 Points
SQL Stage 4: Practice problem.
So it asks to
-- Format dates in all the loans table in the UK format without the year. For example, April 1st is 01/04.
This is my code:
SELECT *, STRFTIME("%d/%m", "loaned_on") AS UK_format FROM loans;
but is there away to use STRFTIME and change the loaned_on and the return_by columns all in the UK format or do you have to do each one separate?
Steven Parker203,226 Points
STRFTIME operates on one timestring.
So you would need to use it on each column that you want to format separately.
Also, you don't need quotes around the column name.
Samandar Mirzayev11,834 Points
SELECT id,book_id,patron_id,STRFTIME("%d/%m", "loaned_on") AS "UK date loaned", STRFTIME("%d/%m","return_by") AS "UK date return by", STRFTIME("%d/%m","returned_on") AS "UK date return" FROM loans;