How to use SQL Queries on Maropost?

How To Use SQL Queries On Maropost?

What is SQL?

SQL stands for “Structured Query Language”. It was created in 1970 by IBM for its relational database system ”System R” . It was first launched as a demo to show how a database could be used as relations. However, it was not available to the public until Oracle released its own version in 1979 and called it “Oracle v2”. It was so efficient and became so popular that is now considered the standard language for relational tables communication. The main advantage of using the SQL language is that it allows retrieving a large amount of data from a database at high speed without needing coding.

What is a database?

In a general context, a database can be any collection of structured information in a computer file. In the context of databases working in conjunction with database systems, a database consists of information structured in rows and columns that make the retrieve and manipulation of the database faster through SQL queries.

What is an SQL query?

An SQL query is asking the computer to give us or modify the data we require. For example, you need to know how many tickets you sell last summer for your caritative event, you’d ask your system to retrieve that data and give it to you. Now, if you asked your computer using the English language it wouldn’t get the question, that’s why you need to ask in a language it understands. That’s why you should ask the question using SQL language, it’s a language that the database system can interpret and understand. That’s what an SQL query is, the asking is the query, and SQL is the language used for the request.

What is the advantage of using SQL queries in Maropost?

Using SQL queries is in Maropost is a big win, since you have the capability of performing queries from inside your CRM. It allows you to append and update data between your relational tables. For example, you need to copy some fields from one table into another one for segmentation purposes, this is a great way of doing it since you only need to perform a couple of queries.

How you can run SQL queries through Maropost?

You can run SQL queries in Maropost through 2 methods: The first one is manually using the SQL queries menu. The second one is done through automation using data journeys. Both of them will execute the same query but if you do it through the data journey builder, Maropost will run this task depending on your triggers.

What are data journeys in Maropost?

Data journeys in Maropost are intended to perform automations just like the normal journeys but this is for applying the actions in bulk. Let’s say you want to modify all of the data of a column inside a database, you would apply this data journey.

How to run SQL Queries in Maropost?

To run SQL queries in Maropost, you first need to create them in order to execute them. In this way, you can have your queries configured to be used in data journeys or on-demand when you need to do it manually. Follow the next steps to start creating your SQL queries so you can use them in some data journeys, or execute them when you need to.

Step 1

1.- First, go to the main dashboard in your Maropost account.  Click on the “Audiences” tab in the main menu.

2.- First you might want to take a look at the “Relational Tables” section. There you’ll be able to see all of the relational tables already created, or you can create or import an existing one. To create a new one click on the “NEW TABLE”.

3.-Now we’ll create a new query that will apply to the databases we already created. Go to the “SQL Queries” located at the same “Audiences tab”. Click on “NEW QUERY” to create a new query.

4.- Give a name to your new query, so you’ll be able to recognize it when creating an automation or when you need to execute it.

5.- Select the relational tables to target for the new query. The selected table is the one that will receive the action from the query.

6.- Select the type of update. You can choose to overwrite the current data in the database, or append, to insert the content and maintain the existing data.

7.-In the quey box, write the code that will be applied when executing the query. Bear in mind that it only allows select queries to perform the actions stated above.

8.- When you finish writing your query, click on “CREATE”.

Step 2

Execute your query manually

To execute your query manually:

1.- Look for the query in the SQL Queries section.

2.- Click on the three dots dropdown.

3.- Click “Execute Query”.

4.- Confirm you want to “EXECUTE”.

Execute your query through data journeys

You can also execute your queries through data journeys so they execute after a trigger.

1.- Look for “Data Journeys” on the main menu.

2.-Click on “New data Journey”.

3.- Give your data journey a name. Click on “Enabled data journey” to set your journey as enabled.

4.- Click “CREATE”.

5.- Select a condition to trigger the query. For this example, we are going to use the “Recurring” trigger, so our query will run on a cycle basis. If you want to use this, choose the date and time for the recurring query execution.

6.- Click “Save”.

7.- Insert the “SQL Query” action.

8.- Look for your query. Click “Save”.

9.- Join your trigger and action.

That’s how you create and execute your queries on Maropost. Without a doubt, this will streamline your database management as you will be able to manipulate your databases directly. If your need help executing your queries or managing your databases we can give you a hand through our Maropost managed service. We can also help you with anything related to your marketing strategies. If you are interested don’t hesitate to contact us and we will reach to you as soon as possible.