82. Extract Year, Month, and Weekday
EasyDates & Timestrftime
strftime(format, date) pulls calendar components out of a date string. '%Y' is the 4-digit year, '%m' the 2-digit month, and '%w' the weekday number where 0 = Sunday … 6 = Saturday.
Task: for each event return id, event_date, yr, mo, and wday where yr/mo/wday are the strftime values above (keep them as the strings strftime returns). Order by id.
Output columns, in order: id, event_date, yr, mo, wday.
Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…
This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases — 5test cases in all. A sloppy query that only fits the example won't pass.
SQL· SQLite · runs in your browser
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.