title: Difference between LATERAL FLATTEN(...) and TABLE(FLATTEN(...)) in Snowflake
body: <p>What is the difference between the use of <code>LATERAL FLATTEN(...)</code> and <code>TABLE(FLATTEN(...))</code> in Snowflake? I checked the documentation on <a href="https://docs.snowflake.com/en/sql-reference/functions/flatten.html" rel="noreferrer"><code>FLATTEN</code></a>, <a href="https://docs.snowflake.com/en/sql-reference/constructs/join-lateral.html" rel="noreferrer"><code>LATERAL</code></a> and <a href="https://docs.snowflake.com/en/sql-reference/literals-table.html" rel="noreferrer"><code>TABLE</code></a> and cannot make heads or tails of a functional difference between the following queries.</p>
  <pre><code>select
      id as account_id,
      account_regions.value::string as region
  from
      salesforce.accounts,
      lateral flatten(split(salesforce.accounts.regions, ', ')) account_regions
  </code></pre>
  <pre><code>select
      id as account_id,
      account_regions.value::string as region
  from
      salesforce.accounts,
      table(flatten(split(salesforce.accounts.regions, ', '))) account_regions
  </code></pre>