• The Query
  • Posts
  • 🤓 An unforgettable SQL adventure

🤓 An unforgettable SQL adventure

Good morning crunchers! This is The Query — the data newsletter that's like a query for your data career. We filter out the irrelevant and bring you the insights that truly matter.

Here’s what we have for you today:

  • An unforgettable SQL adventure

  • Become a riddle master with statistics

  • A SQL function for dealing with pesky NULLs

  • A real dataset from Booking.com (over 500k rows!)

  • And another Spongebob meme 🤭

select * from content-spotlight

1. Go on an unforgettable 8-week SQL adventure with 8 Week SQL Challenge! You know how you can just tell when someone's gone above and beyond to create something special?

Well, this SQL challenge is that kind of deal. You’ll tackle a fresh, exciting SQL case study every week ranging from an “Uber for Pizza” to a lifestyle, adventure clothing company.

2. Understanding databases is foundational in learning the data analytics skillset. At db.grussell.org, an electronic textbook focused on learning about databases is available.

Go ahead and save that bad boy to your bookmark to reference when you’re ready.

3. There’s a new bear on the block (sorry Pandas) and its name is Polars.

And yes, this type of polar…

Okay, here’s what you need to know about Polars:

  • Polars in like Pandas only a whole lot faster.

  • Polars has the same DataFrame concept as Pandas.

  • Polars doesn’t have memory problems like Pandas so next time you’re working with a large data set, give Polars a spin.

  • The Python code looks nearly identical to Pandas, so if you’re comfortable using Pandas, you can pick up Polars in an afternoon.

class LearningResources: 📊

It's time to hunker down, hone your abilities, and get ready to master the realm of data.

You can become a data sorcerer quicker than you might imagine.

Discover our curated learning materials below:

three project-based learning resources

Here's the lowdown on these projects…

The first two projects are guided tutorials to familiarize you with the basics.

But at some point, you need to take off the training wheels.

That’s why project three provides just a dataset - similar to the real world.

two technical tips

Technical time!

One Python tip and one SQL tip for your analytics pleasure…

1. SQL Tip 👨‍💻: COALESCE for NULL Values

When working with data, you’ll inevitably encounter NULL values.

The COALESCE function is a handy tool that allows you to return the first non-NULL value in a list of expressions.

COALESCE can be particularly useful when you want to provide a default value for a column that may have NULL values.

Let's look at an example. Suppose you have a table called products:

In this table, the discount column contains NULL values for some products.

You want to calculate the final price of each product after applying the discount. If the discount is NULL, you want to treat it as 0.

You can use the COALESCE function to achieve this:

The COALESCE function ensures that if the discount is NULL, it is treated as 0, allowing you to calculate the final price correctly.

COALESCE is a powerful tool for handling NULL values, allowing you to provide default values when needed.

This can help you avoid unexpected results when performing calculations or displaying data, making it a useful tool for beginner data analysts.

2. Python Tip 🐍: IF, ELIF, and ELSE

If you’re learning Python for data analysis, you should already know SQL.

So this code should look familiar:

Here’s the Python equivalent:

Your when in SQL acts like the elif in Python and the else keywords both act the same.

When you’re learning Python and already know SQL, pay attention to these similarities. It’ll help you learn faster.

one tool 🔧

Alright, we’re doing it… Meet ChatGPT.

There’s a lot of hype about ChatGPT, but the hype in our opinion is warranted, especially for data analysts working on upskilling.

We use it most for:

  • Helping explain specific concepts

  • Writing SQL and Python

But it can do a whole host of things like:

  • Write your resume and cover letter

  • Edit your emails to recruiters and hiring managers

  • Format your code

  • And so much more

The trick to using ChatGPT well is to get good at prompting — AKA, asking very specific questions. To learn how to prompt better, give this article a read.

Seriously, learning to use ChatGPT well is a insanely powerful tool in the analyst’s toolbelt.

import entertainment as fun

meme of the week

F is for friends who do stuff together…

U is for UNION and me.

N is for anywhere and anytime at all down here in the SQL query.

data visualization of the week

You know that one friend, right? The one who's always bugging the gang with riddles?

They know you can't help but take a crack at it, even though it'll probably leave you scratching your head, feeling like Spongebob in the meme above...

If you're still wondering, "Which friend?", well, maybe it's time to take a look in the mirror! 😄

Anyway, avoid being caught off guard by a riddle again by memorizing a few of the top words on this cheat sheet of the most common riddle solutions (that’ll show that one friend):

That’s it for today.

We’re going to be changing up the format of the newsletter next week to make it a bit more digestible and actionable.

Can’t wait to get your feedback 🤓 

Stay crunchin’ folks and see you next week!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

What'd you think of today's newsletter?

Login or Subscribe to participate in polls.