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.
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.
These are essential for the command to execute successfully. Generally, this includes specifying the target column(s).
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
predictioncolumn is often appended for both classification and regression tasks.
- Analysis Columns: Commands like
SENTIMENTmight add specific columns such as
Column Usage in Commands
- All-Column Commands: Some commands like
PREDICTuse all input columns by default, except for the target column, to perform their operation.
- Target-Only Commands: Other commands like
SENTIMENTonly focus on a specific target column and ignore the rest of the columns in the dataset.
Simplified Command with View
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
country for the prediction, and the output will include these columns along with the
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.