SQL · Schema

SQL Query Result

JSON Schema representing the result of a SQL query execution

ANSI StandardData ManagementDatabaseISO StandardQuery LanguageRelational DatabaseSQL

Properties

Name Type Description
columns array Column metadata for SELECT results
rows array Result rows as arrays of values matching the columns order
rowsAsObjects array Result rows as key/value objects using column names as keys
rowCount integer Number of rows returned (SELECT) or affected (INSERT/UPDATE/DELETE)
affectedRows integer Number of rows modified by INSERT, UPDATE, or DELETE
lastInsertId stringintegernull Auto-generated ID of the last inserted row, if applicable
executionTime number Query execution time in milliseconds
error object
View JSON Schema on GitHub

JSON Schema

sql-result-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12",
  "$id": "https://www.iso.org/schemas/sql-result",
  "title": "SQL Query Result",
  "description": "JSON Schema representing the result of a SQL query execution",
  "type": "object",
  "properties": {
    "columns": {
      "type": "array",
      "description": "Column metadata for SELECT results",
      "items": {
        "$ref": "#/$defs/ColumnMetadata"
      }
    },
    "rows": {
      "type": "array",
      "description": "Result rows as arrays of values matching the columns order",
      "items": {
        "type": "array",
        "items": {
          "oneOf": [
            { "type": "string" },
            { "type": "number" },
            { "type": "boolean" },
            { "type": "null" }
          ]
        }
      },
      "example": [
        [1, "Alice", "alice@example.com"],
        [2, "Bob", "bob@example.com"]
      ]
    },
    "rowsAsObjects": {
      "type": "array",
      "description": "Result rows as key/value objects using column names as keys",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "example": [
        { "id": 1, "name": "Alice", "email": "alice@example.com" },
        { "id": 2, "name": "Bob", "email": "bob@example.com" }
      ]
    },
    "rowCount": {
      "type": "integer",
      "description": "Number of rows returned (SELECT) or affected (INSERT/UPDATE/DELETE)",
      "minimum": 0,
      "example": 2
    },
    "affectedRows": {
      "type": "integer",
      "description": "Number of rows modified by INSERT, UPDATE, or DELETE",
      "minimum": 0,
      "example": 1
    },
    "lastInsertId": {
      "type": ["string", "integer", "null"],
      "description": "Auto-generated ID of the last inserted row, if applicable",
      "example": 42
    },
    "executionTime": {
      "type": "number",
      "description": "Query execution time in milliseconds",
      "example": 12.5
    },
    "error": {
      "$ref": "#/$defs/SQLError"
    }
  },
  "$defs": {
    "ColumnMetadata": {
      "type": "object",
      "description": "Metadata for a single result column",
      "properties": {
        "name": {
          "type": "string",
          "description": "Column name as returned by the database",
          "example": "user_id"
        },
        "type": {
          "type": "string",
          "description": "SQL data type of the column",
          "example": "INTEGER"
        },
        "nullable": {
          "type": "boolean",
          "description": "Whether the column allows NULL values",
          "example": false
        },
        "primaryKey": {
          "type": "boolean",
          "description": "Whether this column is part of the primary key",
          "example": true
        }
      },
      "required": ["name"]
    },
    "SQLError": {
      "type": "object",
      "description": "SQL error information when a query fails",
      "properties": {
        "code": {
          "type": "string",
          "description": "SQL error code (e.g., SQLSTATE)",
          "example": "42P01"
        },
        "message": {
          "type": "string",
          "description": "Human-readable error message",
          "example": "relation \"users\" does not exist"
        },
        "position": {
          "type": "integer",
          "description": "Character position in the SQL string where the error occurred"
        }
      },
      "required": ["message"]
    }
  }
}

Work with this as data

Every JSON Schema here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for schemas

4 MCP tools reach this
  • find_json_schemasBrowse and filter every JSON Schema in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools

Call it yourself

curl for this page
This JSON Schema
curl "https://apis.io/api/v1/json-schemas/sql-result"
All schemas
curl "https://apis.io/api/v1/json-schemas?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.