Introducing Our SQL for Marketers Series
Data helps a marketer be better at their job. Many marketers use tools like Google Analytics and Mixpanel to manage their marketing and product data.
Yet these tools have their limits, whether it’s the way the metric is defined or the way the product was built. This is where SQL comes in. It lets you look at any data you want and gives you a greater understanding of how your data works.
Almost all websites and apps have a database where they store their data. Most of these databases speak SQL, which stands for “structured query language.”
SQL is a programming language designed for managing data held in your database. You can think of it as the language you use to ask questions of your database.
Common SQL Terms
Some of the common terms you’ll come across:
- Database — A database is an organized collection of data. It’s where you store your customer, order, and any other data.
- Query — Queries are the primary way of grabbing information from a database and consist of questions presented to the database in a predefined format.
- Console — The console is where you’ll type in your SQL code.
- Table — A table is a collection of related data held in a structured format in a database.
- Column — A column is a set of data values, one for each row of the table. The columns provide the structure according to how the rows are composed.
- Row — A row in a table represents a set of related data, and every row in the table has the same structure.
Basic SQL Commands
- select — This is the starting point for most SQL queries you’ll run. Select tells your database to give you data. For example, if you want every bit of data, you type select *. Or if you want a specific column from your customers table, you could type select customers_table.created_at (where the table is customers_table and the column is created_at).
- from — After you’ve typed the data you want to select, you need to tell the database what table that data lives in. For example, if you want data from your customers table, you’d type from customers_table.
- where — Often, you don’t want every piece of data in your tables, instead you filter the data. This is what where is for — it either includes or excludes data. For example, if you wanted data on customers who joined after 5/03/14, you’d type where customers_table.created_at > ‘2014-05-03’
join — Many times, you’ll have data you want to analyze in two different tables. For example, you may have one table with your customer data and another with all of your order data. If you want to combine the data into one temporary table, use join.
Resources for Learning
Below are some resources for learning more about SQL in between our lessons:
Next time, we’ll jump into more detail about SQL queries for grabbing data, keeping unwanted data out of your charts, and segmenting data.