A table function is a function returning a table. It can be invoked inside the
FROM clause of a query:
SELECT * FROM TABLE(my_function(1, 100))
The row type of the returned table can depend on the arguments passed with
invocation of the function. If different row types can be returned, the
function is a polymorphic table function.Polymorphic table functions allow you to dynamically invoke custom logic from
within the SQL query. They can be used for working with external systems as
well as for enhancing Trino with capabilities going beyond the SQL standard.
start is the first element in the sequence. The default value is 0.stop is the end of the range, inclusive. The last element in the
sequence is equal to stop, or it is the last value within range,
reachable by steps.step is the difference between subsequent values. The default value is
1.
The result of the sequence table function might not be ordered.
Every table function is provided by a catalog, and it belongs to a schema in
the catalog. You can qualify the function name with a schema name, or with
catalog and schema names:
SELECT * FROM TABLE(schema_name.my_function(1, 100))SELECT * FROM TABLE(catalog_name.schema_name.my_function(1, 100))
Otherwise, the standard Trino name resolution is applied. The connection
between the function and the catalog must be identified, because the function
is executed by the corresponding connector. If the function is not registered
by the specified catalog, the query fails.The table function name is resolved case-insensitive, analogically to scalar
function and table resolution in Trino.
They must be constant expressions, and they can be of any SQL type, which is
compatible with the declared argument type:
factor => 42
Descriptor arguments
Descriptors consist of fields with names and optional data types:
schema => DESCRIPTOR(id BIGINT, name VARCHAR)columns => DESCRIPTOR(date, status, comment)
To pass null for a descriptor, use:
schema => CAST(null AS DESCRIPTOR)
Table arguments
You can pass a table name, or a query. Use the keyword TABLE:
input => TABLE(orders)data => TABLE(SELECT * FROM region, nation WHERE region.regionkey = nation.regionkey)
If the table argument is declared as set semantics,
you can specify partitioning and ordering. Each partition is processed
independently by the table function. If you do not specify partitioning, the
argument is processed as a single partition. You can also specify
PRUNE WHEN EMPTY or KEEP WHEN EMPTY. With PRUNE WHEN EMPTY you
declare that you are not interested in the function result if the argument is
empty. This information is used by the Trino engine to optimize the query. The
KEEP WHEN EMPTY option indicates that the function should be executed even
if the table argument is empty. By specifying KEEP WHEN EMPTY or
PRUNE WHEN EMPTY, you override the property set for the argument by the
function author.The following example shows how the table argument properties should be ordered:
input => TABLE(orders) PARTITION BY orderstatus KEEP WHEN EMPTY ORDER BY orderdate
There are two conventions of passing arguments to a table function:
Arguments passed by name:
SELECT * FROM TABLE(my_function(row_count => 100, column_count => 1))
In this convention, you can pass the arguments in arbitrary order. Arguments
declared with default values can be skipped. Argument names are resolved
case-sensitive, and with automatic uppercasing of unquoted names.
Arguments passed positionally:
SELECT * FROM TABLE(my_function(1, 100))
In this convention, you must follow the order in which the arguments are
declared. You can skip a suffix of the argument list, provided that all the
skipped arguments are declared with default values.You cannot mix the argument conventions in one invocation.You can also use parameters in arguments:
PREPARE stmt FROMSELECT * FROM TABLE(my_function(row_count => ? + 1, column_count => ?));EXECUTE stmt USING 100, 1;
Was this page helpful?
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Upsolve AI","colors":{"primary":"#F13470","light":"#F13470","dark":"#E05883"},"favicon":"https://mintcdn.com/upsolve/yo8HqJNiSHXxC-XO/favicon.svg?fit=max\u0026auto=format\u0026n=yo8HqJNiSHXxC-XO\u0026q=85\u0026s=9b9e554a8bc33ff2f4191464242d130d","logo":{"light":"https://mintcdn.com/upsolve/2iK7L-lfLcwqCcz_/logo/light_logo.svg?fit=max\u0026auto=format\u0026n=2iK7L-lfLcwqCcz_\u0026q=85\u0026s=e2c715b3dad371be16e683c74655b2a8","dark":"https://mintcdn.com/upsolve/2iK7L-lfLcwqCcz_/logo/dark_logo.svg?fit=max\u0026auto=format\u0026n=2iK7L-lfLcwqCcz_\u0026q=85\u0026s=e5b53eb0a41de94b806015890a6b4bdc","href":"https://upsolve.ai"},"api":{"openapi":["api-reference/upsolve.documentation.yaml"],"mdx":{"server":"https://api.upsolve.ai","auth":{"method":"bearer","name":null}}},"navbar":{"links":[{"label":"Support","href":"mailto:support@upsolve.ai"}],"primary":{"type":"button","label":"Request Access","href":"https://upsolve.ai/"}},"seo":{"metatags":{"slack-app-id":"A0C9DAKJQ49"},"indexing":"navigable"},"footer":{"socials":{"website":"https://upsolve.ai/","linkedin":"https://www.linkedin.com/company/upsolveai","hacker-news":"https://www.ycombinator.com/companies/upsolve-ai"}},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Impact Studies","href":"https://upsolve.ai/impact-study","icon":"newspaper"},{"anchor":"Security Trust Center","href":"https://trust.upsolve.ai","icon":"shield-halved"},{"anchor":"Community","href":"https://upsolve-ai-community.slack.com/join/shared_invite/zt-2x9oospxx-vv2uDP_20IafkekwCOMi4A#/shared-invite/email","icon":"slack"},{"anchor":"Blog","href":"https://www.upsolve.com/blog","icon":"newspaper"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"upsolve","hasAudioNarration":false,"actualSubdomain":"upsolve","customDomains":["docs.upsolve.ai"],"gitSource":{"type":"github","owner":"upsolve-labs","repo":"upsolve-core","deployBranch":"main","contentDirectory":"apps/docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae4d29ef29cac1d3d63ffe8","collectionId":"d82697f0-24fd-43c0-83d3-6914571b911b","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae4d29ef29cac1d3d63ffe8"},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae4d61f6d11d33003dd1783","clientVersion":"0.0.4043","searchFilterCounts":[{"language":"default","tag":"Integrations","count":116},{"language":"default","tag":"SQL Reference","count":48},{"language":"default","tag":"Documentation","count":46},{"language":"default","tag":"API Reference","count":35},{"language":"default","tag":"API Documentation","count":26},{"language":"default","tag":"Functions","count":23},{"language":"default","tag":"Analytics Layer","count":22},{"language":"default","tag":"Routines","count":14},{"language":"default","tag":"Chart Configurations","count":12},{"language":"default","tag":"Chart Types","count":12}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"sql/functions/table","slug":"/sql/functions/table","pageMetadata":{"title":"Table functions","description":null,"href":"/sql/functions/table"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`A table function is a function returning a table. It can be invoked inside the\n`,_jsx(_components.code,{children:`FROM`}),` clause of a query:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(my_function(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The row type of the returned table can depend on the arguments passed with\ninvocation of the function. If different row types can be returned, the\nfunction is a `,_jsx(_components.strong,{children:`polymorphic table function`}),`.`]}),`\n`,_jsx(_components.p,{children:`Polymorphic table functions allow you to dynamically invoke custom logic from\nwithin the SQL query. They can be used for working with external systems as\nwell as for enhancing Trino with capabilities going beyond the SQL standard.`}),`\n`,_jsx(Heading,{level:`2`,id:`built-in-table-functions`,children:`Built-in table functions`}),`\n`,_jsx(Heading,{level:`3`,id:`exclude_columns`,children:`exclude_columns`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`exclude_columns(input => table, columns => descriptor) -> table`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Excludes from `,_jsx(_components.code,{children:`table`}),` all columns listed in `,_jsx(_components.code,{children:`descriptor`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(exclude_columns(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` input `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(orders),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` columns `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DESCRIPTOR(clerk, comment)))`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The argument `,_jsx(_components.code,{children:`input`}),` is a table or a query.\nThe argument `,_jsx(_components.code,{children:`columns`}),` is a descriptor without types.`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`sequence(start => bigint, stop => bigint, step => bigint) -> table(sequential_number bigint)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Returns a single column `,_jsx(_components.code,{children:`sequential_number`}),` containing a sequence of\nbigint:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`sequence`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` start`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` stop`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2000000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` step `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`start`}),` is the first element in the sequence. The default value is `,_jsx(_components.code,{children:`0`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`stop`}),` is the end of the range, inclusive. The last element in the\nsequence is equal to `,_jsx(_components.code,{children:`stop`}),`, or it is the last value within range,\nreachable by steps.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`step`}),` is the difference between subsequent values. The default value is\n`,_jsx(_components.code,{children:`1`}),`.`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`The result of the `,_jsx(_components.code,{children:`sequence`}),` table function might not be ordered.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`table-function-invocation`,children:`Table function invocation`}),`\n`,_jsxs(_components.p,{children:[`You invoke a table function in the `,_jsx(_components.code,{children:`FROM`}),` clause of a query. Table function\ninvocation syntax is similar to a scalar function call.`]}),`\n`,_jsx(Heading,{level:`3`,id:`function-resolution`,children:`Function resolution`}),`\n`,_jsx(_components.p,{children:`Every table function is provided by a catalog, and it belongs to a schema in\nthe catalog. You can qualify the function name with a schema name, or with\ncatalog and schema names:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`schema_name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`my_function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`catalog_name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`schema_name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.my_function(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Otherwise, the standard Trino name resolution is applied. The connection\nbetween the function and the catalog must be identified, because the function\nis executed by the corresponding connector. If the function is not registered\nby the specified catalog, the query fails.`}),`\n`,_jsx(_components.p,{children:`The table function name is resolved case-insensitive, analogically to scalar\nfunction and table resolution in Trino.`}),`\n`,_jsx(Heading,{level:`3`,id:`arguments`,children:`Arguments`}),`\n`,_jsx(_components.p,{children:`There are three types of arguments.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Scalar arguments`}),`\n`]}),`\n`,_jsx(_components.p,{children:`They must be constant expressions, and they can be of any SQL type, which is\ncompatible with the declared argument type:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`factor => 42`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.ol,{start:`2`,children:[`\n`,_jsx(_components.li,{children:`Descriptor arguments`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Descriptors consist of fields with names and optional data types:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`schema => DESCRIPTOR(id BIGINT, name VARCHAR)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`columns => DESCRIPTOR(date, status, comment)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`To pass `,_jsx(_components.code,{children:`null`}),` for a descriptor, use:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`schema => CAST(null AS DESCRIPTOR)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.ol,{start:`3`,children:[`\n`,_jsx(_components.li,{children:`Table arguments`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`You can pass a table name, or a query. Use the keyword `,_jsx(_components.code,{children:`TABLE`}),`:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`input => TABLE(orders)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data => TABLE(SELECT * FROM region, nation WHERE region.regionkey = nation.regionkey)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`If the table argument is declared as set semantics,\nyou can specify partitioning and ordering. Each partition is processed\nindependently by the table function. If you do not specify partitioning, the\nargument is processed as a single partition. You can also specify\n`,_jsx(_components.code,{children:`PRUNE WHEN EMPTY`}),` or `,_jsx(_components.code,{children:`KEEP WHEN EMPTY`}),`. With `,_jsx(_components.code,{children:`PRUNE WHEN EMPTY`}),` you\ndeclare that you are not interested in the function result if the argument is\nempty. This information is used by the Trino engine to optimize the query. The\n`,_jsx(_components.code,{children:`KEEP WHEN EMPTY`}),` option indicates that the function should be executed even\nif the table argument is empty. By specifying `,_jsx(_components.code,{children:`KEEP WHEN EMPTY`}),` or\n`,_jsx(_components.code,{children:`PRUNE WHEN EMPTY`}),`, you override the property set for the argument by the\nfunction author.`]}),`\n`,_jsx(_components.p,{children:`The following example shows how the table argument properties should be ordered:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`input `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(orders)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` PARTITION`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` orderstatus`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` KEEP`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` WHEN`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` EMPTY`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ORDER BY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` orderdate`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`argument-passing-conventions`,children:`Argument passing conventions`}),`\n`,_jsx(_components.p,{children:`There are two conventions of passing arguments to a table function:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Arguments passed by name`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(my_function(row_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, column_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`]})})}),`\n`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`In this convention, you can pass the arguments in arbitrary order. Arguments\ndeclared with default values can be skipped. Argument names are resolved\ncase-sensitive, and with automatic uppercasing of unquoted names.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Arguments passed positionally`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(my_function(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`]})})}),`\n`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`In this convention, you must follow the order in which the arguments are\ndeclared. You can skip a suffix of the argument list, provided that all the\nskipped arguments are declared with default values.`}),`\n`,_jsx(_components.p,{children:`You cannot mix the argument conventions in one invocation.`}),`\n`,_jsx(_components.p,{children:`You can also use parameters in arguments:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`PREPARE stmt `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(my_function(row_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ? `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, column_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ?));`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`EXECUTE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stmt `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`USING`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Table functions","description":null,"href":"/sql/functions/table"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Built-in table functions","slug":"built-in-table-functions","depth":2,"children":[{"title":"exclude_columns","slug":"exclude_columns","depth":3,"children":[]}]},{"title":"Table function invocation","slug":"table-function-invocation","depth":2,"children":[{"title":"Function resolution","slug":"function-resolution","depth":3,"children":[]},{"title":"Arguments","slug":"arguments","depth":3,"children":[]},{"title":"Argument passing conventions","slug":"argument-passing-conventions","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"upsolve","siteName":"Upsolve AI","title":"Table functions - Upsolve AI","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-30T17:38:59.270Z","originalFileLocation":"sql/functions/table.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Upsolve AI\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Table functions - Upsolve AI\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Upsolve AI\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.upsolve.ai/sql/functions/table\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://upsolve.mintlify.app/_mintlify/api/og/v2?division=Functions\u0026amp;title=Table+functions\u0026amp;theme=ee308efe25f936e82bf32ff5\u0026amp;signature=2e461b1f0913d7e3981ff5ac9c9e47fe4be8646858599989a28aff5f63d95fd6\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Table functions - Upsolve AI\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://upsolve.mintlify.app/_mintlify/api/og/v2?division=Functions\u0026amp;title=Table+functions\u0026amp;theme=ee308efe25f936e82bf32ff5\u0026amp;signature=2e461b1f0913d7e3981ff5ac9c9e47fe4be8646858599989a28aff5f63d95fd6\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/upsolve/294UabaKv711UkJe/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Upsolve AI\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#F13470\">\u003cmeta data-mint-head name=\"slack-app-id\" content=\"A0C9DAKJQ49\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.upsolve.ai/sql/functions/table\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sql/functions/table.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.upsolve.ai/#organization\",\"name\":\"Upsolve AI\",\"url\":\"https://docs.upsolve.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/upsolve/2iK7L-lfLcwqCcz_/logo/light_logo.svg?fit=max\u0026auto=format\u0026n=2iK7L-lfLcwqCcz_\u0026q=85\u0026s=e2c715b3dad371be16e683c74655b2a8\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.upsolve.ai#website\",\"name\":\"Upsolve AI\",\"url\":\"https://docs.upsolve.ai\",\"publisher\":{\"@id\":\"https://docs.upsolve.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.upsolve.ai/sql/functions/table#webpage\",\"url\":\"https://docs.upsolve.ai/sql/functions/table\",\"name\":\"Table functions\",\"dateModified\":\"2026-10-30T17:38:59.270Z\",\"isPartOf\":{\"@id\":\"https://docs.upsolve.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.upsolve.ai/sql/functions/table#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.upsolve.ai/sql/functions/table#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Functions\",\"item\":\"https://docs.upsolve.ai/sql/functions/aggregate\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Table functions\",\"item\":\"https://docs.upsolve.ai/sql/functions/table\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.upsolve.ai/sql/functions/table#article\",\"headline\":\"Table functions\",\"name\":\"Table functions\",\"url\":\"https://docs.upsolve.ai/sql/functions/table\",\"mainEntityOfPage\":{\"@id\":\"https://docs.upsolve.ai/sql/functions/table#webpage\"},\"dateModified\":\"2026-10-30T17:38:59.270Z\",\"publisher\":{\"@id\":\"https://docs.upsolve.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.upsolve.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Upsolve AI\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Upsolve AI","nav":{"global":{"anchors":[{"anchor":"Impact Studies","href":"https://upsolve.ai/impact-study","icon":"newspaper"},{"anchor":"Security Trust Center","href":"https://trust.upsolve.ai","icon":"shield-halved"},{"anchor":"Community","href":"https://upsolve-ai-community.slack.com/join/shared_invite/zt-2x9oospxx-vv2uDP_20IafkekwCOMi4A#/shared-invite/email","icon":"slack"},{"anchor":"Blog","href":"https://www.upsolve.com/blog","icon":"newspaper"}]},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"tab":"Analytics Layer","pages":[{"title":"Analytics Layer","href":"/embedded-bi/introduction"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/integrations/introduction"}]},{"tab":"Chart Configurations","pages":[{"title":"Chart Configurations","href":"/content/charts/area-line-chart"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/endpoint/create-embed-token"}]},{"tab":"SQL Reference","groups":[{"group":"SQL","pages":[{"title":"Introduction","href":"/sql/introduction"}]},{"group":"Reference","pages":[{"title":"DESCRIBE","href":"/sql/reference/describe"},{"title":"EXECUTE","href":"/sql/reference/execute"},{"title":"PREPARE","href":"/sql/reference/prepare"},{"title":"SELECT","href":"/sql/reference/select"},{"title":"SHOW CATALOGS","href":"/sql/reference/show-catalogs"},{"title":"SHOW COLUMNS","href":"/sql/reference/show-columns"},{"title":"SHOW SCHEMAS","href":"/sql/reference/show-schemas"},{"title":"USE","href":"/sql/reference/use"},{"title":"VALUES","href":"/sql/reference/values"}]},{"group":"Data Types","pages":[{"title":"Data types","href":"/sql/reference/types"}]},{"group":"Functions","pages":[{"title":"Aggregate functions","href":"/sql/functions/aggregate"},{"title":"Array functions and operators","href":"/sql/functions/array"},{"title":"Binary functions and operators","href":"/sql/functions/binary"},{"title":"Bitwise functions","href":"/sql/functions/bitwise"},{"title":"Comparison functions and operators","href":"/sql/functions/comparison"},{"title":"Conditional Expressions","href":"/sql/functions/conditional"},{"title":null,"href":"/sql/functions/conversion"},{"title":"Date and time functions and operators","href":"/sql/functions/datetime"},{"title":"Decimal functions and operators","href":"/sql/functions/decimal"},{"title":"HyperLogLog Functions","href":"/sql/functions/hyperloglog"},{"title":"JSON functions and operators","href":"/sql/functions/json"},{"title":"Lambda expressions","href":"/sql/functions/lambda"},{"title":null,"href":"/sql/functions/map"},{"title":"Machine learning functions","href":"/sql/functions/ml"},{"title":"Quantile digest functions","href":"/sql/functions/qdigest"},{"title":null,"href":"/sql/functions/regexp"},{"title":"Set Digest functions","href":"/sql/functions/setdigest"},{"title":"String functions and operators","description":null,"href":"/sql/functions/string"},{"title":"Table functions","href":"/sql/functions/table"},{"title":"Teradata functions","description":null,"href":"/sql/functions/teradata"},{"title":"URL functions","href":"/sql/functions/url"},{"title":"UUID Functions","href":"/sql/functions/uuid"},{"title":"Window functions","href":"/sql/functions/window"}]},{"group":"Routines","pages":[{"title":"Introduction to SQL routines","href":"/sql/routines/introduction"},{"title":"Example SQL routines","href":"/sql/routines/examples"},{"title":"BEGIN","href":"/sql/routines/begin"},{"title":"CASE","href":"/sql/routines/case"},{"title":"DECLARE","href":"/sql/routines/declare"},{"title":"FUNCTION","href":"/sql/routines/function"},{"title":"IF","href":"/sql/routines/if"},{"title":"ITERATE","href":"/sql/routines/iterate"},{"title":"LEAVE","href":"/sql/routines/leave"},{"title":"LOOP","href":"/sql/routines/loop"},{"title":"REPEAT","href":"/sql/routines/repeat"},{"title":"RETURN","href":"/sql/routines/return"},{"title":"SET","href":"/sql/routines/set"},{"title":"WHILE","href":"/sql/routines/while"}]}]},{"tab":"Demo","pages":[{"title":"Demo","href":"/demo/product-walkthrough"}]}]},"basePath":"","title":"Table functions - Upsolve AI","buildId":"dpl_G9nrg4qeJSZtah1Ziwbc2n6WkLch","deploymentId":"dpl_G9nrg4qeJSZtah1Ziwbc2n6WkLch","dynamics":[],"chunks":[]}