- Open the Database Console for the data source of interest.
- Right-click somewhere within the input pane (that is, the editing area of the corresponding editor tab).
- In the context menu, point to Change '<current_dialect>' dialect to and then select the dialect of interest.
When typing an SQL statement, you can view parameter information on-the-fly or by pressing Ctrl+PCtrl+PCtrl+PCtrl+PShift+Alt+PCtrl+Shift+SpaceCtrl+PCtrl+PCommand PCommand PControl Shift Space. PyCharm informs you about the type of required parameters in a tooltip.
You can use parameters in SQL statements and specify which values should be used in place of these parameters when running the statements:
- When typing a command, enclose the parameters in #, $, or ? characters.
In the Parameters pane, specify the values to substitute for the corresponding parameters at command execution.
Do one of the following:
- Place the caret at the desired name and press Ctrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+Alt+G, Escape, Period, Alt+Period or Ctrl+Button1 ClickF12, Shift+F2, Ctrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickF3 or Ctrl+Button1 ClickCommand B, Command Button1 Click or Button2 ClickCommand B, Command Button1 Click or Button2 ClickF3 or Control Button1 Click. The corresponding table and column are highlighted in the data source for which the console was launched.
With the Ctrl key pressed, hover the mouse pointer over the reference to a table or column.
So doing, the corresponding table or column declaration is displayed in a tooltip, and the reference turns to a hyperlink.
Click the link to jump to the declaration in the data source.
You can run the SQL statements one at a time, or execute a number of statements that follow one another in the console at once:
- To execute a command at the caret, press Ctrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCommand EnterCommand EnterCommand Enter or click on the toolbar.
To run several consecutive commands, select them in the console. Then, press Ctrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCommand EnterCommand EnterCommand Enter or click
on the toolbar.
You can prepare a script in an SQL file, copy and then paste its contents into the Input pane.
When working with the Input pane of the Database Console tool window, you can browse the executed SQL statements one by one by moving to the previous or next statement:
- To navigate to the previous statement, press Ctrl+UpCtrl+UpCtrl+UpCtrl+UpCtrl+UpCtrl+UpCtrl+UpCtrl+UpConsole.History.NextCommand UpConsole.History.Next.
- To navigate to the next statement, press Ctrl+DownCtrl+DownCtrl+DownCtrl+DownCtrl+DownCtrl+DownCtrl+DownCtrl+DownConsole.History.PreviousCommand DownConsole.History.Previous.
When working with the Input pane of the Database Console tool window, you can open the history dialog to see the executed SQL statements all at once.
To open this dialog:
- Press Ctrl+ECtrl+ECtrl+ECtrl+ECtrl+ECtrl+EShift+F4Ctrl+ECommand ECommand ECommand E.
In this dialog, you can:
- Navigate through the list of the executed statements using the UpUpUpUpUp or Ctrl+PUpUpUpUp or Control PUpUp or Control P and DownDownDownDownDown or Ctrl+NDownDownDownDown or Control NDownDown or Control N arrow keys.
- Remove the statements from the history. To delete a statement, select (navigate to) the statement to be deleted and press DeleteDeleteDeleteDeleteDelete or Ctrl+DDeleteDeleteDeleteDelete or BackspaceDeleteDelete or Backspace.
Copy the statements to the Input pane. To copy a statement, do one of the following:
- Double-click the statement to be copied.
- Select (navigate to) the statement of interest and press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter.
- Select the statement and click OK.
As a result, the history dialog closes and the selected statement is copied to the Input pane.