Minimum Examples

These short examples show the simplicity and clarity of AiSQL. Each example demonstrates how real decisions can be expressed using familiar data and straightforward rules — without machine learning, without model training, and without complexity.

Call Center Routing (CSV-Driven)

This example uses a small CSV table to guide decisions. AiSQL automatically loads the rows and evaluates the closest match based on the runtime mode.


MODULE
    MODEL "CallCenterRouting"

    RUNTIME
        STRICT : false
        EvaluationMode : PROXIMITY

    DATA FROM CSV
    '
        SentimentScore,IssueSeverity,WaitTime,Action
        -12.0,4,25,Escalate
        -9.5,3,20,Escalate
        -2.0,1,5,Standard
        1.5,0,2,Standard
    '

    INPUTS
        SentimentScore = -11.0
        IssueSeverity  = 3
        WaitTime       = 22

Bank Loan Classification (CSV-Driven)

A CSV table defines loan decisions based on credit score ranges. This demonstrates how business teams can express decisions without writing rules.


MODULE
    MODEL "LoanClassifier"

    RUNTIME
        STRICT : false
        EvaluationMode : PROXIMITY

    DATA FROM CSV
    '
        CreditScore,Income,DebtRatio,Decision
        720,60000,0.20,Approve
        680,45000,0.35,Review
        590,30000,0.50,Reject
    '

    INPUTS
        CreditScore = 705
        Income      = 58000
        DebtRatio   = 0.27

Call Escalation (Rule-Based)

This example shows the simplest form of rule logic in AiSQL — no CSV, just readable conditions and an outcome.


MODULE
    MODEL "EscalationRules"

    INPUTS
        SentimentScore = -8
        WaitTime       = 12

    RULE
        WHEN SentimentScore < 0
         AND WaitTime > 10
        THEN Escalate

Machine Safety (Rule-Based)

A simple safety rule that responds to sensor inputs.


MODULE
    MODEL "MachineSafety"

    INPUTS
        Temperature = 92
        Vibration   = 3.5

    RULE
        WHEN Temperature > 85
          OR Vibration > 7
        THEN Shutdown