ICON
Help Center / Webservice Insert /

Webservice Insert

Introduction

The "insert" data request can be used to populate datasets available in your Spotzi Account with new data. You can insert single or multiple records at a time. "Insert" data requests can be executed by including an INSERT request with the "q" parameter.

Basic INSERT query

A typical insert query is generally as follows:

INSERT INTO name_dataset ('CODE','NAME','NUMBER')
VALUES ('A','B',3)

The above statement is divided into:


Field list

The field list:

INSERT INTO name_dataset ('CODE','NAME','NUMBER')

States which fields need to be inserted via the insert statement. While specifying these fields is not mandatory, it is strongly advised — If no fields are specified then the insert statement will expect all available fields to be inserted.

Value list

The second section of the insert query is the value list:

VALUES ('A','B',3);

This list states which values need to be inserted.

The columns described in the first part of this query must exist within the dataset for the query to work, and must also match the column type of the given values. Values that are not simple numeric values must usually be surrounded by single quotes (') such as in the following examples.

Examples

Below you will find some example queries that can be used with Spotzi's Webservice. The table names and fields used in these examples must be available in the requested webservice account in order to display a valid result.

INSERT INTO neighbourhood (neighbourhood_name, total_population)
VALUES ('Centre',100)

The above statement inserts a new record in the neighbourhood dataset with the neighbourhood_name "Centre" and a total_population of 100.

INSERT INTO neighbourhood (neighbourhood_name, total_population)
VALUES ('Centre', 100),('North',50)

The above statement inserts two records into the neighbourhood dataset simultaneously.

For more information about SQL INSERT statements please visit the SQL section in our help center, or the official PostgreSQL tutorial.

Related blog posts

Access the Free Spotzi Explorer

Gain access to our free catalog of maps and dashboards. Find Postal Codes, learn more about global income differences or just get inspired by our community maps. Spotzi Explorer is our free solution for every marketer, researcher, student and beyond. Available as a stand alone solution and part of our price plans.

Get free access to Spotzi Explorer Read more
thumbnail Increase Campaign Effectiveness with Near Real-Time OOH Measurement

Blog

Increase Campaign Effectiveness with Near Real-Time OOH Measurement