# Valid SQL

**Objective**\
Validates if the text is a valid SQL statement, ensuring executable and accurate queries.

**Interpretation**\
A higher score indicates the text is not valid SQL. A lower (or zero) score indicates the query is valid.

**Code Execution**

```python
metrics = [
    {
        "name": "Valid SQL",
        "config": {
            "model": "gpt-4o-mini",
            "provider": "openai"
        },
        "column_name": "your-column-identifier",
        "schema_mapping": schema_mapping
    }
]
```

**Example**

* **Prompt**: “Provide a valid SQL query to select all records from the ‘users’ table.”
* **Context**: “Must be syntactically correct.”
* **Response**: `SELECT * FROM users`
* **Metric Output**: `{"score": 1, "reason": "Invalid SQL (missing semicolon in strict syntax)."}`
