These days, just about every app, tool and platform collects data. Whether that’s customer, user or product data, organizations have access to more information than ever before. The more tools you use the more data sources you add and the more data you collect (think CRM, marketing software, payment software, etc).
While more data is great, knowing how to access and segment it is the real advantage for marketers.
To make the most of the data deluge, organizations are embracing the Modern Data Stack as a better way to gather their data in one, unified pipeline. The Modern Data Stack is made up of flexible and scalable data tools, like data warehouses where user data is stored in databases like Redshift, Snowflake, Google BigQuery and many more SQL-style databases.
What is a SQL Database?
SQL stands for “Structured Query Language”: it’s a programming language used to access and manipulate data in a relational database. “Relational database” is just a fancy way of describing data stored in lots of tables with links between them. Think of a relational database as an epic spreadsheet.
To access and manipluate records from a SQL database, a user talks to the database by writing “SQL queries”. An SQL query is essentially an explicit instruction, or series of instructions, to get the data you want, how you want it.
Writing SQL queries has traditionally been the domain of data engineers and analysts. Marketers wanting to pull specific data or segments would usually ask the data team to run a query. Developers generally have better things to do, so the queries wait, leaving marketing little choice but to send campaigns to generic audiences.
Learning to write basic SQL queries is a way that any marketer can get better actionable insights and segments from their data.
How To Write Simple SQL Queries For Email Marketing
One of the key benefits of using SQL for email marketing is that your segments can be very accurate, giving marketers the ability to query and use specific user data.
Here is some simple example of popular SQL queries to help you get familiar with how SQL looks.
To put it into practice, let’s use this example:
Find every user who has signed up since the start of 2022, who is currently on a trial, and who has not created any “widgets” yet.
This is fairly typical of the sort of query a SaaS company might do to send a message to trial users for feedback.
SELECT chooses the specific information you want to pull from your database.
FROM specifies the table to select and pull the data from.
WHERE allows you to specifically filter your query.
AND allows you to add additional criteria to your first WHERE statement.
Using our example above to search for every user who signed up since the start of 2022, who is currently on a trial but hasn’t created any “widgets”. The SQL query would look like this:
Why Query SQL Directly?
Most marketing technology and email products try to be both your customer data platform and your marketing software. This is old-school thinking. Your customer data platform (CDP) and your marketing software don’t need to be the same. Because your data already lives in a database or central data warehouse, paying a vendor to store your data means you’re paying multiple times to store the same data in multiple places.
Cost aside, one of the other issues with current systems is data accuracy. The more places you store your data, the more syncing is needed to keep your data up-to-date. Syncing introduces “room for error” that can lead to inaccurate data.
Querying data directly at its source using languages like SQL means you’re reading from a single source of truth. This cuts the risk of sending the wrong message to the wrong person, or, potentially missing marketing opportunities because your data hasn’t synced.
How To Use SQL With Email Marketing
Unlike traditional marketing platforms that require constant syncing, Vero Connect is the first email marketing platform built specifically for the modern data stack, enabling you to use SQL to query your data directly from databases and data warehouses.
Vero’s inbuilt SQL editor makes it simple to run queries and narrow down an audience or segment to import into Vero Connect for that particular send.
Once you’ve run a valid query and are happy with the results, the results of that query are loaded as the list of recipients to send the newsletter to. You can also use the data loaded from the query to personalize the content of the email using dynamic fields.
Popular SQL databases and data warehouses
Easy ways to edit or write SQL queries