This reference doc is generated based on this [example schema](https://firebase.google.com/docs/reference/sql-connect.md.txt#graphql_schema).

Object types define a collection of fields representing an entity in a GraphQL schema.

Developer defines [`@table`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#table) types and SQL Connect generates queries and mutations
based on them.

## Developer Defined and SQL Connect Generated

### type MainTable

🔨 MainTable is an example of developer defined table type to demonstrate
various supported column types in a Postgres table.

```sql
type MainTable @table {
  uuidField: UUID
  stringField: String @searchable
  intField: Int
  int64Field: Int64
  floatField: Float
  booleanField: Boolean
  dateField: Date
  timestampField: Timestamp
  anyField: Any
  vectorField: Vector @col(size: 768)
}
```

`@table(key)` defines the primary key. If not configured otherwise, uses the
primary key field `id`. If the `id` field isn't present already, SQL Connect
implicitly adds an auto-generated UUID primary key field: `id: UUID! @default(expr: "uuidV4()")`

| Field | Type | Description |
|---|---|---|
| `uuidField` | [`UUID`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | 🔨 uuidField is an example of developer defined column as [`uuid`](https://www.postgresql.org/docs/current/datatype-uuid.html) type. |
| `stringField` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | 🔨 stringField is an example of developer defined column as [`text`](https://www.postgresql.org/docs/current/datatype-character.html) type. Indexed for full-text search. |
| `intField` | [`Int`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | 🔨 intField is an example of developer defined column as [`int`](https://www.postgresql.org/docs/current/datatype-numeric.html) type. |
| `int64Field` | [`Int64`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int64) | 🔨 int64Field is an example of developer defined column as [`bigint`](https://www.postgresql.org/docs/current/datatype-numeric.html) type. |
| `floatField` | [`Float`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Float) | 🔨 floatField is an example of developer defined column as [`double precision`](https://www.postgresql.org/docs/current/datatype-numeric.html) type. |
| `booleanField` | [`Boolean`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Boolean) | 🔨 booleanField is an example of developer defined column as [`boolean`](https://www.postgresql.org/docs/current/datatype-boolean.html) type. |
| `dateField` | [`Date`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Date) | 🔨 dateField is an example of developer defined column as [`date`](https://www.postgresql.org/docs/current/datatype-datetime.html) type. |
| `timestampField` | [`Timestamp`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Timestamp) | 🔨 timestampField is an example of developer defined column as [`timestamptz`](https://www.postgresql.org/docs/current/datatype-datetime.html) type. |
| `anyField` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) | 🔨 anyField is an example of developer defined column as [`jsonb`](https://www.postgresql.org/docs/current/datatype-json.html) type. |
| `vectorField` | [`Vector`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Vector) | 🔨 vectorField is an example of developer defined column as [`pgvector`](https://github.com/pgvector/pgvector) type. `@col(size: 768)` defines its length to work with [`google_ml_integration`](https://cloud.google.com/sql/docs/postgres/integrate-cloud-sql-with-vertex-ai) Postgres extensions in your Cloud SQL someFieldbase. |
| `uuidArray` | [`[UUID]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | 🔨 uuidArray is an example of developer defined column as [`uuid[]`](https://www.postgresql.org/docs/current/datatype-uuid.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `stringArray` | [`[String]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | 🔨 stringArray is an example of developer defined column as [`text[]`](https://www.postgresql.org/docs/current/datatype-character.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `intArray` | [`[Int]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | 🔨 intArray is an example of developer defined column as [`int[]`](https://www.postgresql.org/docs/current/datatype-numeric.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `int64Array` | [`[Int64]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int64) | 🔨 int64Array is an example of developer defined column as [`bigint[]`](https://www.postgresql.org/docs/current/datatype-numeric.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `floatArray` | [`[Float]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Float) | 🔨 floatArray is an example of developer defined column as [`double precision[]`](https://www.postgresql.org/docs/current/datatype-numeric.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `booleanArray` | [`[Boolean]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Boolean) | 🔨 booleanArray is an example of developer defined column as [`boolean[]`](https://www.postgresql.org/docs/current/datatype-boolean.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `dateArray` | [`[Date]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Date) | 🔨 dateArray is an example of developer defined column as [`date[]`](https://www.postgresql.org/docs/current/datatype-datetime.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `timestampArray` | [`[Timestamp]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Timestamp) | 🔨 timestampArray is an example of developer defined column as [`timestamptz[]`](https://www.postgresql.org/docs/current/datatype-datetime.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `anyArray` | [`[Any]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) | 🔨 anyArray is an example of developer defined column as [`jsonb[]`](https://www.postgresql.org/docs/current/datatype-json.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. |
| `id` | [`UUID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | ✨ Implicit primary key field. It's a UUID column default to a generated new value. See [`@table`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#table) for how to customize it. |
| `_metadata` | [`_Metadata`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#_Metadata) | Implicit metadata field that cannot be written. It provides extra information about query results. |
| `__typename` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | This is not a generated field, it models the builtin GraphQL field called `__typename`, which varies per table. |
| `_id` | [`ID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#ID) | A generated field that is used for caching results in SDKs. |
| `_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `id_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `id` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `anyField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `anyField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `anyField_max` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) | ✨ Maximum of the `anyField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `anyField_min` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) | ✨ Minimum of the `anyField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `booleanField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `booleanField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `dateField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `dateField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `dateField_max` | [`Date`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Date) | ✨ Maximum of the `dateField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `dateField_min` | [`Date`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Date) | ✨ Minimum of the `dateField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `floatField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `floatField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `floatField_max` | [`Float`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Float) | ✨ Maximum of the `floatField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `floatField_min` | [`Float`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Float) | ✨ Minimum of the `floatField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `floatField_sum` | [`Float`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Float) | ✨ Sum the `floatField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `floatField_avg` | [`Float`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Float) | ✨ Average the `floatField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `int64Field_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `int64Field` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `int64Field_max` | [`Int64`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int64) | ✨ Maximum of the `int64Field` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `int64Field_min` | [`Int64`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int64) | ✨ Minimum of the `int64Field` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `int64Field_sum` | [`Int64`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int64) | ✨ Sum the `int64Field` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `int64Field_avg` | [`Float`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Float) | ✨ Average the `int64Field` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `intField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `intField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `intField_max` | [`Int`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Maximum of the `intField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `intField_min` | [`Int`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Minimum of the `intField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `intField_sum` | [`Int`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Sum the `intField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `intField_avg` | [`Float`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Float) | ✨ Average the `intField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `stringField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `stringField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `timestampField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `timestampField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `timestampField_max` | [`Timestamp`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Timestamp) | ✨ Maximum of the `timestampField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `timestampField_min` | [`Timestamp`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Timestamp) | ✨ Minimum of the `timestampField` field in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table. |
| `uuidField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `uuidField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `vectorField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) table where the `vectorField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `manyToManyJoinTables_on_left` | [`[ManyToManyJoinTable!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) | ✨ List [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) objects in a one-to-many relationship (where [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable).`left` is this object). |
| `manyToManyJoinTables_on_right` | [`[ManyToManyJoinTable!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) | ✨ List [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) objects in a one-to-many relationship (where [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable).`right` is this object). |
| `mainTables_via_ManyToManyJoinTable_on_right` | [`[MainTable!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) | ✨ List [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) objects using [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) as the join table (a [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) object exists where its `left` is this and its `right` is that). |
| `mainTables_via_ManyToManyJoinTable_on_left` | [`[MainTable!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) | ✨ List [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) objects using [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) as the join table (a [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) object exists where its `right` is this and its `left` is that). |
| `manyToOneExamples_on_main` | [`[ManyToOneExample!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) | ✨ List [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) objects in a one-to-many relationship (where [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample).`main` is this object). |
| `oneToOneExample_on_main` | [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) | ✨ List [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) objects in a one-to-one relationship (where [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample).`main` is this object). |

### type ManyToManyJoinTable

🔨 ManyToManyJoinTable is an example of developer defined join table that
establishes a many-to-many relationship between [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) and itself.

```sql
type MainTable @table {
  someField: Any
}
type ManyToManyJoinTable @table(key: ["left", "right"]) {
  left: MainTable!
  right: MainTable!
}
```

NOTE: it's primary key are two columns with foreign key constraints to both
sides of the many-to-many relationship. The primary key constraint ensures that
for any given pair of [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) rows, there is only one matching row in
[`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable).

| Field | Type | Description |
|---|---|---|
| `left` | [`MainTable!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) | 🔨 left is an example of developer defined foriegn key constraint to the [`MainTable!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable). It's part of primary key columns pair of [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable). |
| `right` | [`MainTable!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) | 🔨 right is an example of developer defined foriegn key constraint to the [`MainTable!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable). It's part of primary key columns pair of [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable). |
| `leftId` | [`UUID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | ✨ Implicit foreign key field based on [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable).`left`. It must match the value of [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable).`id`. See [`@ref`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#ref) for how to customize it. |
| `rightId` | [`UUID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | ✨ Implicit foreign key field based on [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable).`right`. It must match the value of [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable).`id`. See [`@ref`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#ref) for how to customize it. |
| `_metadata` | [`_Metadata`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#_Metadata) | Implicit metadata field that cannot be written. It provides extra information about query results. |
| `__typename` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | This is not a generated field, it models the builtin GraphQL field called `__typename`, which varies per table. |
| `_id` | [`ID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#ID) | A generated field that is used for caching results in SDKs. |
| `_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) table. |
| `leftId_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) table where the `leftId` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `rightId_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`ManyToManyJoinTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToManyJoinTable) table where the `rightId` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |

### type ManyToOneExample

🔨 ManyToOneExample is an example of developer defined table type to demonstrates
an one-to-many relationship between [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) and [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample).

```sql
type MainTable @table {
  someField: Any
}
type ManyToOneExample @table {
  main: MainTable!
  someField: Any
}
```

| Field | Type | Description |
|---|---|---|
| `main` | [`MainTable!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) | 🔨 main is an example of developer defined foriegn key constraint to the [`MainTable!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable). Each row of [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) has exactly one corresponding row in [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable). Each row of [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) can be associated with multiple rows in [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample). |
| `someField` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) |   |
| `id` | [`UUID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | ✨ Implicit primary key field. It's a UUID column default to a generated new value. See [`@table`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#table) for how to customize it. |
| `mainId` | [`UUID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | ✨ Implicit foreign key field based on [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample).`main`. It must match the value of [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable).`id`. See [`@ref`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#ref) for how to customize it. |
| `_metadata` | [`_Metadata`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#_Metadata) | Implicit metadata field that cannot be written. It provides extra information about query results. |
| `__typename` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | This is not a generated field, it models the builtin GraphQL field called `__typename`, which varies per table. |
| `_id` | [`ID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#ID) | A generated field that is used for caching results in SDKs. |
| `_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) table. |
| `id_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) table where the `id` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `mainId_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) table where the `mainId` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `someField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) table where the `someField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `someField_max` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) | ✨ Maximum of the `someField` field in the [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) table. |
| `someField_min` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) | ✨ Minimum of the `someField` field in the [`ManyToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#ManyToOneExample) table. |

### type OneToOneExample

🔨 OneToOneExample is an example of developer defined table type to demonstrate
an one-to-maybe relationship between [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) and [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample).

```sql
type MainTable @table {
  someField: Any
}
type OneToOneExample @table {
  main: MainTable! @unique
  someField: Any
}
```

| Field | Type | Description |
|---|---|---|
| `main` | [`MainTable!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) | 🔨 main is an example of developer defined foriegn key constraint to the [`MainTable!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable). The column also has a SQL unique constraint, which makes it a one-to-one relationship. Each row of [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) has exactly one corresponding row in [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable). Each row of [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable) can be associated with one or none row in [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample). |
| `someField` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) |   |
| `id` | [`UUID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | ✨ Implicit primary key field. It's a UUID column default to a generated new value. See [`@table`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#table) for how to customize it. |
| `mainId` | [`UUID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | ✨ Implicit foreign key field based on [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample).`main`. It must match the value of [`MainTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#MainTable).`id`. See [`@ref`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#ref) for how to customize it. |
| `_metadata` | [`_Metadata`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#_Metadata) | Implicit metadata field that cannot be written. It provides extra information about query results. |
| `__typename` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | This is not a generated field, it models the builtin GraphQL field called `__typename`, which varies per table. |
| `_id` | [`ID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#ID) | A generated field that is used for caching results in SDKs. |
| `_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) table. |
| `id_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) table where the `id` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `mainId_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) table where the `mainId` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `someField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) table where the `someField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `someField_max` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) | ✨ Maximum of the `someField` field in the [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) table. |
| `someField_min` | [`Any`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Any) | ✨ Minimum of the `someField` field in the [`OneToOneExample`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#OneToOneExample) table. |

### type StringTable

🔨 StringTable is an example of developer defined table type to demonstrate
array and non-null columns in a Postgres table.

```sql
type StringTable @table {
  stringField: String
  nonNullStringField: String!
  stringArray: [String]
  nonNullStringArray: [String!]
  stringNonnullArray: [String]!
  nonNullStringNonnullArray: [String!]!
}
```

| Field | Type | Description |
|---|---|---|
| `stringField` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | 🔨 stringField is an example of developer defined column as [`text`](https://www.postgresql.org/docs/current/datatype-character.html) type. |
| `nonNullStringField` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | 🔨 nonNullStringField is an example of developer defined column as [`text`](https://www.postgresql.org/docs/current/datatype-character.html) type. Since it cannot be null, SQL Connect automatically adds a `NOT NULL` constraint to the column. |
| `stringArray` | [`[String]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | 🔨 stringArray is an example of developer defined column as [`text[]`](https://www.postgresql.org/docs/current/datatype-character.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. SQL Connect doesn't support sparse arrays. Backend drops any null elements in the array before returning the result. `stringArray` and `nonNullStringArray` are equivalent. |
| `nonNullStringArray` | [`[String!]`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | 🔨 nonNullStringArray is an example of developer defined column as [`text[]`](https://www.postgresql.org/docs/current/datatype-character.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. SQL Connect doesn't support sparse arrays. Backend drops any null elements in the array before returning the result. `stringArray` and `nonNullStringArray` are equivalent. |
| `stringNonnullArray` | [`[String]!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | 🔨 nonNullStringNonnullArray is an example of developer defined column as [`text[]`](https://www.postgresql.org/docs/current/datatype-character.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. Since it cannot be null, SQL Connect automatically adds a `NOT NULL` constraint to the column. SQL Connect doesn't support sparse arrays. Backend drops any null elements in the array before returning the result. `stringNonnullArray` and `nonNullStringNonnullArray` are equivalent. |
| `nonNullStringNonnullArray` | [`[String!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | 🔨 nonNullStringNonnullArray is an example of developer defined column as [`text[]`](https://www.postgresql.org/docs/current/datatype-character.html) [array](https://www.postgresql.org/docs/current/arrays.html) type. Since it cannot be null, SQL Connect automatically adds a `NOT NULL` constraint to the column. SQL Connect doesn't support sparse arrays. Backend drops any null elements in the array before returning the result. `stringNonnullArray` and `nonNullStringNonnullArray` are equivalent. |
| `id` | [`UUID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#UUID) | ✨ Implicit primary key field. It's a UUID column default to a generated new value. See [`@table`](https://firebase.google.com/docs/reference/sql-connect/gql/directive.md.txt#table) for how to customize it. |
| `_metadata` | [`_Metadata`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#_Metadata) | Implicit metadata field that cannot be written. It provides extra information about query results. |
| `__typename` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | This is not a generated field, it models the builtin GraphQL field called `__typename`, which varies per table. |
| `_id` | [`ID!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#ID) | A generated field that is used for caching results in SDKs. |
| `_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`StringTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#StringTable) table. |
| `id_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`StringTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#StringTable) table where the `id` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `nonNullStringField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`StringTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#StringTable) table where the `nonNullStringField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |
| `stringField_count` | [`Int!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Int) | ✨ Count the number of rows in the [`StringTable`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#StringTable) table where the `stringField` field is non-null. Pass the `distinct` argument to instead count the number of distinct values. |

## Built In

### type __Directive

A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.

In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.

| Field | Type | Description |
|---|---|---|
| `name` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `description` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `locations` | [`[__DirectiveLocation!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/enum.md.txt#__DirectiveLocation) |   |
| `args` | [`[__InputValue!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__InputValue) |   |
| `isRepeatable` | [`Boolean!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Boolean) |   |

### type __EnumValue

One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.

| Field | Type | Description |
|---|---|---|
| `name` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `description` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `isDeprecated` | [`Boolean!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Boolean) |   |
| `deprecationReason` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |

### type __Field

Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.

| Field | Type | Description |
|---|---|---|
| `name` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `description` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `args` | [`[__InputValue!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__InputValue) |   |
| `type` | [`__Type!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) |   |
| `isDeprecated` | [`Boolean!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Boolean) |   |
| `deprecationReason` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |

### type __InputValue

Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.

| Field | Type | Description |
|---|---|---|
| `name` | [`String!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `description` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `type` | [`__Type!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) |   |
| `defaultValue` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) | A GraphQL-formatted string representing the default value for this input value. |
| `isDeprecated` | [`Boolean!`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#Boolean) |   |
| `deprecationReason` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |

### type __Schema

A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.

| Field | Type | Description |
|---|---|---|
| `description` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `types` | [`[__Type!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) | A list of all types supported by this server. |
| `queryType` | [`__Type!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) | The type that query operations will be rooted at. |
| `mutationType` | [`__Type`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) | If this server supports mutation, the type that mutation operations will be rooted at. |
| `subscriptionType` | [`__Type`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) | If this server support subscription, the type that subscription operations will be rooted at. |
| `directives` | [`[__Directive!]!`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Directive) | A list of all directives supported by this server. |

### type __Type

The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the [`__TypeKind`](https://firebase.google.com/docs/reference/sql-connect/gql/enum.md.txt#__TypeKind) enum.

Depending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.

| Field | Type | Description |
|---|---|---|
| `kind` | [`__TypeKind!`](https://firebase.google.com/docs/reference/sql-connect/gql/enum.md.txt#__TypeKind) |   |
| `name` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `description` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |
| `fields` | [`[__Field!]`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Field) |   |
| `interfaces` | [`[__Type!]`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) |   |
| `possibleTypes` | [`[__Type!]`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) |   |
| `enumValues` | [`[__EnumValue!]`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__EnumValue) |   |
| `inputFields` | [`[__InputValue!]`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__InputValue) |   |
| `ofType` | [`__Type`](https://firebase.google.com/docs/reference/sql-connect/gql/object.md.txt#__Type) |   |
| `specifiedByURL` | [`String`](https://firebase.google.com/docs/reference/sql-connect/gql/scalar.md.txt#String) |   |