SQL for Marketers
- 1 hour on-demand video
- 8 articles
- 3 downloadable resources
- Full lifetime access
- Access on mobile and TV
- Certificate of Completion
Get your team access to 4,000+ top Udemy courses anytime, anywhere.Try Udemy for Business
- You'll learn how to write SQL queries as well as any developer.
- By the end of this course, you'll understand what SQL is and how you can harness it to become a better marketer.
- You'll have plug and play code snippets that will allow you to use SQL immediately to gather data about your customers.
- You'll have a valuable new skill that will immediately make you a better, more data-driven marketer or growth hacker.
- Access to the Internet
**UPDATED AS OF NOVEMBER 2015 - JOIN 9,000+ SUCCESSFUL STUDENTS!**
Become a technical marketer with this course on using SQL for data analysis. You'll learn:
- Initial Setup and SQL Basics
- The 6 Components that Make Up Every SQL Query
- How to Use SQL to Query Any Database
- Pre-built Queries You Can Run Today to Get Info About Your Customers
Technical marketers are in high demand and low supply. Being able to dive into data on your own, with no help from engineering, makes you a much better marketer.
This is why SQL is so powerful - it allows you to see any data you want about anything your customers do. Knowing how to use SQL is literally a marketing superpower.
As someone who can understand and use SQL, you'll be a (highly paid) marketing unicorn - able to dig into data and also execute high-level marketing campaigns. Many companies - including Udemy! - are now requiring that their marketing leaders have an understanding of SQL.
Many marketers have tried to become "technical" - including me - but have failed over and over again after coming across resources meant only for engineers. I know I've had this issue - every SQL tutorial out there was created for developers, not marketers. Other tutorials include topics like creating a database, inserting data, managing tables, and other specifics that database administrators need to know.
What if I told you that marketers only need to know a small amount of SQL to use it for analytics... and to run more profitable campaigns?
Good news - This is the truth!
This course is the best resource for marketers, growth hackers and product managers who want to get more technical and learn SQL. It's what I wish existed when I was going through tutorial after tutorial, sifting through lots of information that didn't apply to me and trying to learn on my own.
And - best of all - you don't need to know programming or be technical to take this course. In fact, you don't have to be technical to know how to use SQL!
SQL is simple enough that - just by learning a few concepts I'll cover in this course - you'll be able to use it for any kind of data analysis, cohort analysis or campaign breakdown.
Everything I've put into this course are the product of years of teaching myself to program, understanding software technology and writing thousands of SQL queries for my own marketing and growth campaigns. The concepts and queries in this course are used every day by the marketing teams at companies like eBay, Moz, Udemy, HubSpot... you name it.
I've used my knowledge of SQL to cut churn by more than 60% while running growth at developer-tools startup Airbrake (acquired by Rackspace), and to analyze and improve multiple profitable marketing campaigns. Knowing SQL has given me incredible insight into our customer base, and allowed our marketing team to move much faster than we did when we had to wait for engineering to give us the data we requested.
But don't just listen to me. Here's what a few other people have said:
"About four weeks back, I learned SQL, and it's been one of the greatest skills I could have ever acquired as a marketing / business guy at a startup."
- Dinesh Thiru, Head of Marketing at Udemy
"I loved this course. I was able to power through it within 3 hours and have a solid base of understanding for SQL.
As a digital marketer, it's important that I have access to my database and customer information BUT that I do not waste valuable developer resources. This course aims to bridge that gap by teaching you the tools you need to query your SQL database and running your own reports.
I can't recommend this course enough for SQL newbies. I now have a base of understanding of SQL and excited to use it at work this week!"
- Benjamin Hoffman, course student
Some things you'll learn in this course:
- The 6 components that make up every SQL query a marketer will ever use
- How to find your most profitable users, and how to make sure you run campaigns that attract more like them
- 5 key metrics you can measure right away after learning SQL
- How to run a cohort analysis
- How to discover the "aha" moment in your product that indicates whether a new user will stay an active customer or close their account
- Access to pre-built queries you can start using immediately to learn about your customer base
Trust me, this is just a small sample of what you'll learn. By the end of this course you'll be more technical than 90% of marketers out there, and 100% better at your job.
I'll also personally respond to any questions you may have as you go through the material, so there's no worry if you think this might be too technical or too confusing. I've included only the essentials marketers need to know, and created the course I wish I had years ago when I was learning this stuff.
As a last bonus, I'll personally guarantee your satisfaction. If for any reason you don't think the course was valuable, I'll personally refund your entire purchase amount, no questions asked.
See you inside,
P.S. If you have (or are looking) to become a better marketer, investing a few dollars in yourself will be the best investment you ever make. And, if you don't like the course, I'll give you a 100% refund - my guarantee.
- This course is for any marketer or product manager who wants an understanding of what their users and customers are doing. SQL is a powerful tool you can use to become data-driven and make critical marketing and product decisions, and this course is the easiest way to learn it.
- Growth hackers
- Product managers
- Startup founders
- Analytics users
SQL allows you to answer common questions marketers and product managers have about their customers:
- Are you getting more customers or less this month compared to previous?
- What percentage of customers are active every week on your platform?
- How many users leave each week (churn)? Is this trending up or down?
- Who are your 100 most active users? Who are your 100 most valuable customers?
- Who are my most valuable customers?
- Where did they come from?
- What’s my churn/LTV? Is it getting better or getting worse?
And so on. Try to think - what do you wish you knew more about your business? Then use SQL to answer those questions.
Before moving on to the next stage of the course, take 2 minutes to do the following:
- Figure out what metric you want to learn more about throughout this course and post it in the discussion portion of the course.
- Example: "I want to learn more about who my most valuable customers are."
In this lecture, we'll cover what SQL is, why it's powerful, and why it's so important to understand it as a marketer.
If you're confused (or even curious) about the kinds of things you can do with SQL, this will be a great lecture to watch. Otherwise, if you already have a strong understanding of what SQL is and how it works, feel free to skip to Lecture 5!
I want you to have a big win by the end of this course. First, decide what key metric you’d like to learn more about or improve in your business. Maybe it’s seeing who your best customers are, learning where most of your new signups are coming from, or decreasing your churn. Decide what metric you want to learn more about with SQL, and then do the above steps.
Let’s take a second and have you do 2 things to get the most from this course.
1. Email your developer and ask him or her to give you read-only access to your database, or to set up a ‘slave’ server that you can run queries against.
2. Ask your developer to show you quickly how to run queries against this database. You’re likely using Heroku Dataclips, phpMyAdmin or some other relatively standard database management tool. Be sure to ask if you’re using SQLite3, PostgreSQL, MySQL or some other type of SQL engine.
Really. Take 5 minutes to have someone on your team set this up for you. If you’re on your own, check out the links in the resources on how to set up Heroku Dataclips or phpMyAdmin, two of the more popular solutions out there.
Challenge time! Use the select and where statements to answer the challenge question.
This lecture answers the challenge question posted in Lecture 10. Try to watch that lecture (and get your own answer) before going through this one!
- Select— This command tells SQL what data you want to see. This data needs to be a part of the table you’re accessing.
- From— this command tells SQL where to pull the data from. What’s the name of the table you’re using to capture data? Put that after the “from” statement.
Join — This command temporarily joins two tables we’d like to search, so that we can pull data from multiple queries. “Join” tells SQL which table we’d like to join, and the “on” modifier tells SQL which columns in those tables should map to each other.
Where— This statement tells SQL how to access the right data. In this case, we’re telling it to show us users who have gotten errors in production AND who have signed up within a certain time period.
Group by – This statement tells SQL how to group your data when it returns the query result. In this case, data will be grouped by name in the ‘users’ table. Think of this as a massive sort function in Excel.
Order by – This statement tells SQL how to order your data. This can be useful when pulling massive amounts of information from the database.
Limit – This tells SQL how much data to return. In our case, we’ll only receive the first 15 results that fit the results of this query.
Use this information to write your queries. Remember, you have to name the tables and columns you want to pull data from.
Show – displays all databases or tables (depending on your selection)
Use – tells SQL which database you want to use to run queries on
Describe – describes column data
This lecture covers how to sort and/or limit data that's returned from a SQL query you craft.
Sorting and limiting data is incredibly useful for when you return a large amount of data that's impractical to sort through on your own. With these statements, SQL allows you to sort and limit the data it's going to return, which makes large data sets far easier to work with.
For this part, we're going to show you how to construct some basic SQL queries using the test SQL database from W3 school. Though these examples will be more fitting for an ecommerce store, you should get a good idea of how to construct these queries by scratch, and you'll be able to see the output they generate.
In real life, you'll be able to query your database for whatever parameters you want, then dump that data into an Excel or other spreadsheet for easy, non-programattic analysis.
First, let's look at how you can find out how many orders each customer placed. Write a query that shows the number of orders a customer has placed.
One student, Theodor, also has posted an alternative answer in the discussion group, for those of you interested:
o.customerid as "Customer ID", c.customername as "Customer Name", count(o.customerid) as "Number of Orders"
orders o, customers c
o.customerid = c.customerid
group by 1
count(o.customerid) > 1
order by 3 desc
Take a look at the results in your browser. Were you able to see a list of customer names, customer IDs, and a count of how many orders they placed? If you wanted to, you could download this data into a spreadsheet for more analysis.
Think how you could apply this in your business:
- You could email repeat buyers a discount coupon to get them to order more
- You could run a regression analysis to see how much more valuable repeat customers are than customers that only buy once
- You could see where your most valuable customers came from (Facebook ads? AdWords? Blog posts?) and then start replicating that marketing strategy
- You could use the demographic data from your top customers to build new ad targeting demographics
One student also discovered an alternative solution, found below:
select countrylanguage.language, country.code, sum(country.population*countrylanguage.percentage/100)
join country on countrylanguage.countrycode = country.code
group by countrylanguage.language
order by sum(country.population*countrylanguage.percentage) desc
SQL is especially useful for cohort analysis. A cohort analysis is a method of analyzing a metric by comparing its behavior between different groups – also known as cohorts – of users. These are generally based on the dates that a user started using a service or application.
This kind of data allows you to see if you’re attracting users with higher LTVs, measure the efficacy of marketing campaigns over time, and see how retention compares between different cohorts
In this case, we’re looking at all users who generated an error in the month of March, 2014. Then, we can compare this to other groups of users from previous months to see if new users are sending more errors (aka using the product more)
You can script queries so they’ll run automatically at certain times each month.
Another thing you can do – which I’ve done with a consulting client – is look and see if they’ve done a key metric by the end of the week. Let’s say you run Udemy and want to see if a new customer has taken a course within the first week they’ve signed up. You can easily create a SQL script to pull customer’s emails who have created a Udemy account but haven’t taken a course yet and email them a coupon for 50% off their first course. Running data-driven marketing campaigns like these has a larger impact than just about any other campaign you could run.
Lastly, reporting. Often, it’s easier to pull relevant data from SQL and put it into Excel or Google Docs for analysis, charts and reporting. With a simple script (you’ll probably need 10 minutes of a developer’s time to do this), you can write a query and have it automatically email you data you care about at the end of every week or month. You can then plug this into any metrics dashboards or spreadsheets you use to report on your marketing.
If you ever have to work with an unfamiliar database, this lecture will show you some very simple ways to figure out the column and table names used in that database.
I highly recommend watching this lecture before writing any queries on a production database, as if you use the wrong column or table name you could accidentally return the wrong data... which will then defeat the entire purpose of learning SQL in the first place :)
This method of finding table and column names works for any sort of database or software tool you (or your company) use to write SQL queries.