Skip to main content


SQL-inf extends any SQL dialect by introducing specialized commands designed for data analysis and predictive analytics. Understanding the syntax will enable you to get the most out of SQL-inf's capabilities. This document discusses the general structure, input handling, and output generation in SQL-inf.

General Structure

SQL-inf commands integrate seamlessly into SQL SELECT statements and come after the FROM <table_or_view> clause. Additional arguments can be used to customize the behavior of the command.

SELECT * FROM <table_or_view> COMMAND(<required_arguments> [, <optional_arguments>])

Or, when selecting specific columns:

SELECT column1, column2 FROM <table_or_view> COMMAND(<required_arguments> [, <optional_arguments>])


Table or View

For optimal results, it's recommended to perform feature engineering or data transformation in a view before invoking an SQL-inf command. By doing so, the SQL-inf command itself remains simple and clean.

Typically, you can use SELECT * FROM <view> if the view already has all the required features.

Required Arguments

These are essential for the command to execute successfully. Generally, this includes specifying the target column(s).

Optional Arguments

These additional key-value arguments allow you to customize the command further. They are usually enclosed in square brackets in the syntax documentation.


Depending on the specific command and options, SQL-inf commands append new columns to the dataset.

Common Output Types

  • Probability Columns: For classification tasks, columns prefixed with probability_ may be appended.
  • Prediction Columns: A prediction column is often appended for both classification and regression tasks.
  • Analysis Columns: Commands like SENTIMENT might add specific columns such as Positive, Neutral, Negative.

Column Usage in Commands

  • All-Column Commands: Some commands like PREDICT use all input columns by default, except for the target column, to perform their operation.
  • Target-Only Commands: Other commands like SENTIMENT only focus on a specific target column and ignore the rest of the columns in the dataset.


Simplified Command with View

Here, customer_view includes all the necessary features for predicting churn. Therefore, the command remains simple.

SELECT * FROM customer_view PREDICT(churn)

Manual Column Selection

You can select specific columns when using SQL-inf commands. This is useful when the table or view has additional columns that you want to include in the output but not use in the prediction or analysis.

SELECT age, country, churn, probability, prediction FROM customer_data PREDICT(churn)

In this example, PREDICT will use age and country for the prediction, and the output will include these columns along with the churn, probability, and prediction.

Target-Only Command

Commands like SENTIMENT use only the target column, ignoring all other input columns.

SELECT * FROM reviews SENTIMENT(review_text)

By understanding the syntax of SQL-inf, you'll be empowered to use its full suite of features for data analysis and prediction.