> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superjoin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create custom SQL queries

> Learn how to create custom queries in Superjoin with a comprehensive guide. This section covers various methods, including writing SQL queries, using the Visual SQL Builder, and generating queries with AI. Follow the step-by-step instructions to import and manage your data effectively, ensuring a smooth setup and optimal data analysis.

<Check> Only available on Google Sheets </Check>

## Follow the quickstart guide to get started with Superjoin 🚀

<CardGroup cols={2}>
  <Card title="Quickstart" icon="flag-checkered" iconType="duotone" href="/quickstart">
    Install Superjoin in under a minute and start pulling your data instantly.
  </Card>

  <Card title="Common Issues" icon="life-ring" iconType="duotone" href="/issues-launching-superjoin">
    We've listed down common issues that you might face & how to fix it.
  </Card>
</CardGroup>

## Steps to create queries ✨

<Warning>
  Ensure Superjoin is installed and working before following the rest of the
  guide.
</Warning>

<Steps titleSize="h2">
  <Step title="Open sources page">
    Click on the `Sources` tab. This will open the sources page in the sidebar.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/0-home-page.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=32712aa727d3dc4e6c4aba33e9f119b1" width="3024" height="1716" data-path="images/queries/0-home-page.png" />
    </Frame>
  </Step>

  <Step title="Select a source">
    Click on the desired source which you wish to create a query for.
    <Tip>You can use the [Integrations](/integrations/summary) tab in the documentation to set-up an integration.</Tip>

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/1-sources.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=ee681a63950340e5b27a9f287d6715f8" width="3024" height="1716" data-path="images/queries/1-sources.png" />
    </Frame>
  </Step>

  <Step title="Select the import option">
    Click on `Create new import` button.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/2-import-export-drawer.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=5daf4cc82b809795eff362ceceee8200" width="3024" height="1716" data-path="images/queries/2-import-export-drawer.png" />
    </Frame>
  </Step>

  <Step title="Select Query Method">
    Choose between three query methods through which you would like to import your data.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/3-select-method.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=0c0fbcab5e8c522c394858a1b2562ac0" width="3024" height="1716" data-path="images/queries/3-select-method.png" />
    </Frame>
  </Step>

  <Step title="Method 1: Custom Query">
    * Click on `Custom Query` to use the custom query method.
    * Enter the desired SQL query in the text area.
    * Click on `Run Query` to preview the data.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/4-sql-query.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=af92b9e517386880e32d311fc647723f" width="3024" height="1716" data-path="images/queries/4-sql-query.png" />
    </Frame>
  </Step>

  <Step title="Method 2: Visual SQL builder">
    * Click on `Visual SQL Builder` to use the visual SQL builder.
    * Select a table and its desired columns to import.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/5-visual-sql-builder.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=ae08fd22ced285b78b62fcec21390eb3" width="3024" height="1716" data-path="images/queries/5-visual-sql-builder.png" />
    </Frame>
  </Step>

  <Step title="Optional: using the &#x22;Join&#x22; operator">
    Here, you can use a combination of columns from different tables to get the desired output.

    E.g., Here we are trying to use the `id` from the `account` columns to fetch the `email` and `amount` from the
    `account` and `investment` columns, respectively.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/6-sql-join.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=afc0d9ece49ec236eece8b64110dc1ec" width="3024" height="1716" data-path="images/queries/6-sql-join.png" />
    </Frame>
  </Step>

  <Step title="Method 3: Generate Query with AI">
    * Click on `Generate Query with AI` to generate a query for your data using AI.
    * In the text area, type the desired prompt to generate a query for your data.
    * Click on `Generate Query`.
    * Click on `Run Query` to run the generated query.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/7-sql-query-ai.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=6acb265e6754aaa616f8636f5c099806" width="3024" height="1716" data-path="images/queries/7-sql-query-ai.png" />
    </Frame>
  </Step>

  <Step title="Saving the query">
    Click on `Import` to import the data and wait for the data to be imported (optionally, create a refresh schedule).

    * Click on the `3 dots` button on the top right corner of the desired query.
    * Click on `Save Query`.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/8-save-query.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=bb48c6496e05ee6bedfb4b7f73a60a6d" width="3024" height="1716" data-path="images/queries/8-save-query.png" />
    </Frame>
  </Step>

  <Step title="Describe the query">
    Fill in the `Name` and `Description (Optional)` of the query.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/9-query-details.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=a5afbb17443a00d7c6c739f0b28679aa" width="3024" height="1716" data-path="images/queries/9-query-details.png" />
    </Frame>
  </Step>

  <Step title="Save the query">
    Click on the `Save Query` button to save the query.

    <Frame>
      <img src="https://mintcdn.com/superjoin/95T8cmea616drJuC/images/queries/10-query-saved.png?fit=max&auto=format&n=95T8cmea616drJuC&q=85&s=3697b8981c3579f1036e47c085381597" width="3024" height="1716" data-path="images/queries/10-query-saved.png" />
    </Frame>
  </Step>
</Steps>
