GoLand 2019.1 Help

Run a query

To run a query, use a database console. The database console is an SQL file where you can compose and execute SQL statements. When you create a data source, a database console is created automatically. For more information about database consoles, see Database consoles.

Create a database console

To create a console, use one of the following actions in the Database tool window (View | Tool Windows | Database).

  • Click a data source and select File | New | Console.

  • Right-click a data source and select New | Console.

  • Click a data source, press Alt+Insert, and select Console.

  • Click a data source, press Ctrl+Shift+F10, and select New console.

Open a console

  • In the tool window (View | Tool Windows | ), navigate to Scratches and Consoles | Database Consoles | <data_source_name>, double-click a console file.

  • In the Database tool window, click the Jump to console icon (the Jump to console icon ) and select a console.

  • Click a data source, press F4, and select the console that you need.

Open a console

Save a console as a file

In the console file, press N/A. Navigate to the directory where you want to store the file.

Save the console contents as a file

Execute an SQL statement

  1. Place the cursor within the statement.

  2. Press Ctrl+Enter. Alternatively, click the Execute icon The Execute icon on the toolbar.

    If you have several statements, select whether you want to execute all statements or a single statement. The suggestion list always contains an item for running all the statements.

Run a query

Attach a directory with SQL files

  1. Click File | Open.

  2. Navigate to the folder that you want to attach.

  3. Click Open.

  4. In the Open Project dialog, click Attach.

Attach a directory to the project

Detach a directory with SQL files

In the Project tool window (View | Tool Windows | Project), right-click a directory and select Detach Directory from current project.

Detach a directory with SQL files

Run existing SQL files

  1. Right-click the file that you want to run and select Run <file_name>.

  2. Select a console in which you want to run a file.

  3. Click OK.

Run existing SQL files

Run SQL files from the editor window

  1. Double-click an SQL file to open it in GoLand.

  2. Right-click the code in the editor and select Attach Console.

  3. Select a console file that you want to use.

  4. Click the Run icon (Shift+F10).

  5. Select statements that you want to execute and press Enter.

Run existing SQL files
Last modified: 17 May 2019