DataGrip 2018.3 Help

Run a query

After you connected to a database, you can 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.

Open a console

  • In the Files tool window (View | Tool Windows | Files), 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 (runJdbcConsole) and select a console.

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

Execute an SQL statement

  1. Place the cursor within the statement.

  2. Right-click the statement and select Execute (Ctrl+Enter). Alternatively, click the Execute icon The Execute iconon the toolbar.

  3. 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.

Attach a directory with SQL files

  1. Navigate to View | Tool Windows | Files.

  2. In the Files tool window, right-click any area and select Attach directory.

  3. Navigate to the directory that you want to attach.

  4. Click OK.

Run existing SQL files

  1. Double click an SQL file to open it in DataGrip.

  2. From the <console> drop-down list, select a console file that you want to use.

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

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

Last modified: 28 November 2018