Preppin' Data 2021 WK01 in SQL

This blog will talk through my process in solving the 2021 wk1 preppin' data challenge in SQL.

I started with this dataset:

Task 1:

To do this I decided to use the function split_part(), which splits a selected string and generates a new column. I also used a RTRIM and LTRIM to remove an whitespaces. In this instance I split based on where a "-" occurred. Because I knew that I wanted to reference these columns later I made this a CTE.

Task 2:

I decided the best way to clean up the bike column was to make use of the first letter. I therefore used a case statement, where I set a predetermined value based on the first letter of a word.

Task 3:

To do this I used the QUATER() and DAYOFMONTH() function.

Task 4:

To remove the first 10 rows I used a WHERE statement.

CHALLENGE COMPLETE!

Author:
Dan Booth
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab