- The Query
- Posts
- 🤓 A SQL Function for Cleaning Data
🤓 A SQL Function for Cleaning Data

The Query (aka Kyle and Cody) here 👋
Here’s what we have for you today:
A SQL function for cleaning data 👨💻
A cool new chart type to learn 📊
Looking for a job in data? Check out these open jobs 💼
Some classic memes 🤣
select * from data-jobs
remote, data jobs
Open to exploring new job opportunities?
We cultivate the best data analyst jobs from around the internet to make your search easier.
Check out this week’s featured jobs here.
Data Analyst @ Cardinal Health — $78-112k per year
Senior Data Analyst @ Honor — $136-145k per year
Senior Data Analyst, Product @ Clari — $88-98k per year
freelance gigs
Need work experience? Get real experience with real projects.
SQL & PowerBI Help — $25-50 per hour (apply here)
Data Analyst Needed — $45-75 per hour (apply here)
Excel Tutor — $intermediate (apply here)
def content_spotlight(🔦):
Check out this cool data visualization of a 24 year old’s software engineering job search.
Here’s the summary: 434 applications → 5 interviews → 1 offer
I think it’s helpful for those looking for jobs too see other people’s actual data.
That way you don’t get discouraged and keep on being persistent!
By the way, this kind of chart is called a Sankey Diagram.
They’re great for visualizing flows and funnels of data.
Add this chart type to your data visualization toolbelt!

class SQLMiniLesson:
A SQL Function for Cleaning Data
Kyle here 👋 — The REPLACE function in SQL is a handy tool for cleaning data.
It allows you to replace any characters you want with anything else.
It's commonly used to remove characters from a string of text by replacing them with an empty string "".
The syntax for the REPLACE function is as follows:
REPLACE(input_string, search_string, replacement_string)
Let's consider an example where we have a table named users with email addresses formatted with <> around them.
This is something I've run into as a data analyst.
The data looks something like the table below.

We want to remove the <> characters from the email addresses.
We can use the REPLACE function in a query to achieve this.
In this example, we use nested REPLACE functions to remove both < and > characters.
The inner REPLACE function removes the < character by replacing it with an empty string (''), and the outer REPLACE function removes the > character in the same way.
This can be particularly helpful when working with datasets that contain inconsistencies, typos, or specific formatting that needs to be adjusted before analysis.
While there are my customizable solutions (like Regex) for cleaning data, the REPLACE function offers a simple and efficient method for making these adjustments directly within your SQL queries, without the need for external tools or programming languages.
import memes as 😂


content & resources 🤓
1. Become a Data Analyst Guide: Our full guide on what it takes to land a job as a data analyst.
2. Open Data Analyst Jobs: Find your next data job here!
3. Download our SQL Cheatsheet as a PDF and desktop wallpaper here.
That’s it for today.
Stay crunchin’ folks and see you next week!
— Kyle & Cody

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
What'd you think of today's newsletter? |