Data-Driven Marketing with SQL

Information processing and data analysis concept. Flat design, modern vector illustration.

How to Work Better and Faster with SQL Basics?

Data-driven marketing isn’t the future – it’s what the best marketers are using for their work right now. In this article, we give you the lowdown on an amazing marketing hack that more and more employers are demanding. Read on and find out if SQL can boost your campaigns by helping you pursue a more data-driven approach. If you’re interested in learning more, take our SQL Basics course. Aimed at beginners, this simple guide will walk you through exactly what you need to know about SQL to make big gains at work!

SQL for Marketers

If you’re a marketer, you’re probably big on words. You know that words sell, and you’re talented at harnessing them to appeal to customers’ needs, desires, and emotions.

But who are your customers? What are their interactions with your product? Which ones are slipping by the wayside? Which need special attention?

To find these answers, you can politely clear your throat next to a long-suffering IT colleague, hoping they’ll be receptive to doing a bit of database trawling for you. Not until next Tuesday? Ah, well, then your work will just have to wait a bit.

Luckily, there’s a way to clear this blockage in the collaborative pipeline. An increasing number of marketers are hacking the IT department’s wait-time and doing database research themselves. Furthermore, many companies are now insisting on hiring marketers who already have this skill.

So, if you’re a wordsmith and not a numbers ninja, what’s the way forward?

The answer, friends, is SQL.

What is SQL?

Structured Query Language (pronounced both as “S-Q-L” and “sequel”) is a basic programming language used to retrieve data from databases. It’s commonly used by software developers, database developers, and administrators, but it can be an asset to people in many different roles.

With data analysis skills now in high demand, you’re far more likely to land a great marketing gig if you have SQL skills in your toolbelt.

But what’s all the fuss about? What does SQL actually do?

To get an idea, let’s take a brief look at the most common and useful concept in SQL: the query.

An SQL query uses a set syntax to request information from the database. It’s like ordering a “decaf soy latte, to go, extra sugar please,” just … in IT-speak. That IT-speak can get complicated if you’re going to become an SQL guru, but if you want to use it in your daily marketing work, you’ll only need to know the basics.

One of the basic elements of SQL syntax is the JOIN keyword. Simply put, SQL joins bring different tables together so the data can be analyzed as such.

You might find yourself using SQL joins if your company stores different categories of customer data in different tables, or if you want to compare relevant data from elsewhere with your existing database. We look at an example of SQL joins in a marketing case study below, so skip on down if you want to learn more.

Limitations of traditional marketing

Marketing is a highly creative field, but there are limitations to the traditional approach. From the Mad Men days of the Madison Avenue advertising elite to the big screen masterpieces of the Super Bowl, marketing appeals to audiences’ senses and emotions. To that end, those of us with experience in the marketing world are accustomed to thinking in terms of colors, typefaces, synonyms, and signage. Those things are still important, of course, but data-driven marketing is the elephant in the room we can no longer ignore.

Some of the limitations of a traditional marketing method include:

  • A blanket approach to generating traffic and leads

If you’re a marketer, you’re busy as heck. Your focus is typically on large-scale campaigns and that ever-present pressure to just get more customers. Although you’ll no doubt employ a number of strategies based on customer segmentation, due to lack of time and lack of data, those groups are often established in a less-than-scientific way.

  • Too much time spent gathering data

The head honcho at your company says: “We need a great marketing campaign this week!”

“I’m on it!” you announce with optimism. But as you try and develop a data-driven marketing strategy, you feel bereft of information when it comes to exactly who it is you’re marketing to.

You ask your IT colleagues for information from your customer database. Unfortunately, they’re too busy to help you. Therefore, you and your teammates put your heads together and try to scramble some data out of thin air. It’s time-consuming and frustrating, and you’re getting nowhere.

  • Impersonal campaigns

You go ahead with a blanket campaign targeting, well, everyone. It looks shiny, your boss is happy, but it has little to no effect on lead generation (although it’s hard to tell exactly, because you don’t have access to the right data to be able to conduct proper reporting when the campaign is over.) Traditional marketing lacks the personal focus that’s so important in a targeted digital advertising era.

  • Undercooked performance metrics and reporting

Marketers’ traditional lack of access to data doesn’t just affect the campaigns they run. It also impacts how they report on those campaigns. I don’t know about you, but I’ve had to pull together some pretty questionable metrics in the past to prove a campaign’s worth to managers. Without access to the right data, how can you achieve meaningful campaign reporting and learn lessons for the future?

Why People are Turning to Data-driven Marketing

“Data-driven marketing” may sound like a buzzword, like “growth-hacker” or “influencer,” but it is far more than hot air. The term refers to marketing strategies founded on insights from “big data.” It can help you predict future customer behavior and work more effectively with your current customer base.

By using SQL to analyze your databases and follow a data driven marketing strategy, you can be much more effective at organizing, analyzing, and applying data to your marketing campaigns.

Here are just some of the ways SQL will make you a better marketer:

  • It will make you a generalist specialist.

For a long time, we were told that the best move for our careers was to establish ourselves as either a generalist or a specialist. But times have changed, and these days companies have different expectations of their new hires. Managers are looking for marketing generalists who have both a broad understanding of the marketing cycle and a specialized skill such as coding, designing, or analyzing data.

  • Learning SQL will ramp-up the speed of your team’s performance.

No more waiting around for a developer to help you analyze basic database information? Win. Your team will be more efficient, gather better insights, and run better campaigns.

  • SQL will help you learn more about your audience.

You’re not just going to be more efficient. You’re going to be more awesome all around! The insights you can gain from using SQL to access your database are practically limitless. Get in there and give it a go – you’ll learn some pretty interesting stuff about your business and its customers!

  • You’ll be able to perform your own quantitative analysis.

You have questions. We all do. Sometimes, you mull those questions over but consider the answers too tricky to unearth. However, if you become familiar with SQL, the world of quantitative analysis is your oyster. SQL helps you reach the answer quickly and your marketing objectives by the time your morning coffee mug is empty.

SQL Marketing Case Study

Let’s imagine you’re a marketer for a telecommunications company – we’ll call it TeleBoom.

TeleBoom’s executive leadership team wants to roll out new marketing campaigns that will lift the subscription rates of your weakest customer segments. They’ve asked you to come up with targeted campaigns that reel in those undersubscribed groups, and you don’t have long to get it done!

Often, your team might pick customer groups based on perception or rough data. Traditional marketing is more of an art than a science, but in today’s data-driven world, marketing is best approached “numbers first, art after.”

TeleBoom’s customer data is kept in one large database, which is made up of a number of tables. One table, for example, hosts basic data about the customer and their contract, while a second table contains information about the type of packages customers are signed up to. Samples of the two are copied below (of course, only a small selection of the data is shown).

Sample of CUSTOMER_DETAIL table




So, how can SQL help with your campaign?

Well, SQL for marketers is a bit like a spaceship – if you know which buttons to push, it can take you to great heights. That’s the beauty of data-driven marketing! For the purposes of this article, I just want to introduce you to the two basic concepts I outlined earlier. If you want to learn more, click here to take our beginner-friendly SQL Basics course.

Making SQL Queries

One of the most important SQL features you can learn as a marketer is a simple query. A query is a question posed to the database, using SQL, which prompts it to retrieve the relevant data.

Let’s say you want to know if TeleBoom’s newer customers are committing to yearly plans or not.

First, you’ll need to write an SQL query requesting information on how many customers who have been with the company for two years or less are subscribed to month-to-month contracts. To do so, you’ll want to use SQL to COUNT the number of data entries from the CUSTOMER_DETAIL table WHERE the tenure of that customer is less than two years and the contract type is month-to-month. The syntax is pretty logical once you get the hang of it and reads almost exactly the same as you’d write it in English. The SQL query for this objective would look like the following:

WHERE TENURE <= 2 AND CONTRACT_TYPE = 'Month-to-month'

And the result would look like this:

Row NumberCount

Then, you’ll do the same with customers who have been with the company less than two years and are on a yearly contract. See below:


And the result:

Row NumberCount

The result we get from these queries (three new customers are on month-to-month contracts, and one new customer is on yearly contract) shows that those who have been with TeleBoom two years and under appear more reluctant to sign on for longer terms.

There’s also a great opportunity here to use a data driven marketing strategy and market to these newer customers by offering incentives to switch to a yearly plan. Hello, customer retention! Later, when you’re reporting on the campaign, you can go back and repeat the process and discover how many month-to-month customers signed up to yearly plans. Marketing win, reporting win – tick and tick!

Joining Tables with SQL

Here’s another opportunity for an easy marketing triumph. Let’s say you have a hunch that your senior customers aren’t accessing your full range of products, presenting an opportunity to upsell. TeleBoom has a bunch of new movie classics coming to its streaming service (think Gone with the Wind, Casablanca, etc), and you think your older customers would love them.

You want to verify your hunch that seniors are undersubscribed to your movie streaming package. The problem is that the data about your customers’ age and the products they’re paying for are held in separate tables within the database.

Fortunately, SQL can help data analysts to join separate tables, so that data can be queried together. We can do this with our two sample tables.

First, we ask SQL to count the total number of senior citizens from the CUSTOMER_DETAIL table:

Row NumberCount

The result would be a total count of four seniors.

Next, we run a query to determine how many senior citizens don’t have our movie streaming service using the join feature:

Row NumberCount

This query would tell us there are three seniors who do not have our movie package.

Therefore, because the results show that more than 50 percent of senior customers are not currently subscribed to TeleBoom’s movie streaming service, there’s an opportunity here to run a targeted marketing campaign through data driven advertising. We know TeleBoom will be streaming some great classic movies in the near future, so we can use these golden oldies to appeal to our senior customers. Hurrah!

This sample dataset is highly simplified, and if you’re new to SQL, you won’t suddenly be equipped to run off into some sort of data analysis sunset. However, this example should give you some idea about how a little SQL knowledge can help you acquire insights that previously seemed out of reach.

Basic SQL – Your Key to Success in Data-driven Marketing

Learning SQL may be the most useful skill you’ll learn on the road to becoming a data-driven marketing whizz. Being the SQL-savvy marketer in your team will:

  • Help you understand the demographics following your different platforms (ie, why do your Facebook signups have a greater lifetime value than your Adwords signups?);
  • Enable your company to provide better products and better services to its customers;
  • Make campaign metrics and reporting a breeze;
  • Help you work faster and smarter;
  • Empower you to communicate more effectively with other departments in your organization; and
  • Make your boss so happy that they’ll (hopefully) pay you more!

So, if you’d like to gain a little competitive advantage in your marketing work by having a basic knowledge of SQL – we’re here to help. Vertabelo Academy offers an affordable SQL Basics course that you can work through at your own pace.

People who’ve already taken the course tell us they love its digestible explanations and user-friendly structure, as well as the hands-on approach of the modules.

If you’re keen to learn as you go, ask your IT department for read-only access to your company’s database, and play around with the basic skills you’ve learned. You’ll quickly see that SQL for marketers is not as overwhelming as you may have imagined! Just as it’s totally achievable to learn enough Spanish to order a taco in Cancún, it’s absolutely within your power to become a data-driven marketing powerhouse thanks to SQL!

Rebecca McKeown

Rebecca is a former journalist and government analyst who is now working as a full-time freelance writer and editor. With three master’s degrees in International Affairs from three different countries under her belt, she’s now happily settled in a blueberry-colored ‘tiny house’ in rural New Zealand with her Hungarian software developer fiancé and their little lamb, Jenny. Rebecca is passionate about making technical information accessible and interesting, and she gets excited about punchy writing, architectural design, and good chocolate.