Categories
Analysis Analytics Business Tips

5 SQL Queries Every Analyst Should Know

SQL is one of the most important tools in any analyst’s toolkit. Whether you’re pulling transactional sales data, cleaning messy records, or preparing insights for dashboards, SQL is often the very first step.

If you’re just getting started, here are the five SQL queries that will cover 80% of your daily work as an analyst.


SELECT

The Foundation

This is your bread and butter: pulling data from a table.

Think of SELECT as your “give me the data” query. It’s the most basic — and the most powerful — command in SQL.

CODE SNIPPET:


WHERE

Filtering Results

Analysts rarely want all the data. WHERE lets you focus on what matters.

CODE SNIPPET:

For example, the query above pulls only shipped orders after January 1, 2025. Trust me, this is especially important when you’re working with millions of records that go back years. You do not want to be poring over a list that seems infinite and neither does the recipient who may have requested the ad-hoc report from you.

WHERE can be used to filter by categories or conditions as well.


GROUP BY

Summarizing Data

Aggregation is where insights begin. GROUP BY helps you summarize large datasets.

CODE SNIPPET:

Now you can see which products have the most orders. Perfect for identifying bestsellers or analyzing trends.


JOIN

Combining Tables

Most real-world data lives in multiple tables. JOIN lets you stitch it together.

CODE SNIPPET:

This connects customer details with their order history. Almost every analytics project requires joins at some point.

JOIN is often the most confusing query that beginners come across since there are different types. It can get confusing but don’t let that intimidate you, I’ll cover the different types of joins in a separate post 🙂


CASE

Adding Logic to Queries

Sometimes you need to create quick categories without exporting to Excel or Python. That’s where CASE comes in.

CODE SNIPPET:

This example creates a new column that classifies orders as “High Value” or “Standard.”

WRAPPING UP

These five SQL queries are the building blocks of data analysis. Master them, and you’ll unlock the ability to:

  • Extract exactly the data you need
  • Summarize and explore patterns
  • Connect multiple sources together
  • Add quick insights directly in SQL

Once you’re comfortable with these basics, you’ll be ready for more advanced techniques like CTEs, window functions, and query optimization.

Ardonna •ᴗ•

Ardonna Cardines Avatar

Categories
Analysis Analytics Growth Notes Thoughtful Thoughts

Why Mercury Musings?

Mercury rules Virgo, and as a Virgo, I’ve always been detail-oriented, analytical, and curious about how things connect. If you asked me ten years ago that my career would revolve around data and analytics, I wouldn’t have believed you. I was a pre-nursing major in college and that first year, I realized the medical field wasn’t for me. By sophomore year, I was lost trying to figure out a new major to switch to and I spent weeks trying to decide until I came across Information Management.

I know, soooooooooo interesting and cool right?!

Tbh, I don’t remember exactly how I discovered it but I remember part of my decision stemmed from taking a business class that all freshman students were required to take. It was an introductory course to using tools like Excel and PowerPoint. Out of all the classes I took my freshman year, that was the one I enjoyed the most.

It wasn’t until my senior year of my undergrad that I finally realized I was on the right path and doing something I enjoyed. Funnily enough, it wasn’t until a couple of years ago that I made the connection between my sun sign (Virgo) and the field I ended up in — ha ha ha. If you’re even a *little* into astrology, then you’d know that Virgo is ruled by Mercury.

Which leads me into the next part: my blog name.

the name: mercury musings

I’ve never been one for boring usernames or titles — I’ve lost count of all the moments in my academic career where I’d sit down to write an essay or report and I’d spend an absurd amount of time just trying to think of a title. If you’re a millennial who grew up watching SpongeBob, this is me just thinking of a title:

Any who, back to why I chose the name. I wanted something unique and creative that would play on both my personality and professional style:

Mercury = planet of communication, detail, and intellect

+

musings = casual reflections, notes, and insights.

Together, Mercury Musings reflects both my professional mindset and my personal curiosity: thoughtful, precise, and always seeking connections.

And if you’re a Sailor Moon fan, you can already guess which character speaks to me the most:

what you’ll find here.

Mercury Musings is a place where I’ll share:

Tips + Tutorials — breaking down concepts and techniques in data science and analytics.

Project Reflections — walking through real-world analyses, from dashboards to clustering models.

Insights — thoughts on decision-making, detail-oriented work, and the learning process.

My goal is to write in a way that’s approachable, useful, and a little personal — mixing the precision of analytics with the curiosity that Mercury inspires. And I probably won’t be able to help myself from throwing in a meme or two or many…

Fair Warning: You’ll probably even see me post about random non-data related things that I think are cool or stuff that I’m obsessed with like a new book, my favorite brand of yarn, my go-to purse, or my new favorite game •⩊•

looking ahead.

For now, this space is a blog — a place for me to write, reflect, and share. Over time, it will grow into a larger portfolio, with project showcases, teaching resources, and eventually research.

In other words, Mercury Musings is not just about where I am today, but where I’m headed. So —

welcome.

If you’re interested in analytics, detail-driven decision-making, or simply enjoy thoughtful yapping from a Virgo mind, I invite you to follow along.

Welcome to Mercury Musings.

Ardonna •ᴗ•

Ardonna Cardines Avatar