Syntax
Infer commands are SELECT
statement clauses that are applied to the data returned by the SELECT
statement.
Infer command can only appear after a well-formed SELECT
statement and only one Infer command can be applied per SELECT
statement.
However, Infer commands can be chained to form more complicated Infer commands depending on the output of a previous command.
Infer commands also work perfectly within sub-queries of SELECT
statements, meaning that Infer commands can be used at multiple-layers of a nested SQL statement.
In many ways, Infer commands behave very similar to GROUP BY
.
Besides the Infer specific commands SQL-inf is compliant with standard ANSI SQL.
Examples
The following statements are allowed
SELECT * FROM companies PREDICT(churn)
SELECT * FROM companies EXPLAIN(PREDICT(churn, model='reg')) LIMIT 500
SELECT location, company_size, inf.prediction as predicted_renewal
FROM companies PREDICT(contract_renewal_value)
WHERE prediction IS NOT NULL ORDER BY prediction DESC
The following statements are not allowed
SELECT * FROM EXPLAIN(CLUSTER(why)) companies
SELECT EXPLAIN(CLUSTER(why)) FROM companies