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 Working with database consoles.
Create a database console
To create a console, use one of the following actions in the Database tool window ( ).
Click a data source and select.
Right-click a data source and select.
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 Files tool window ( ), navigate to , double-click a console file.
In the Database tool window, click the Jump to console icon () and select a console.
Click a data source, press F4, and select the console that you need.
Save a console as a file
In the console file, press Ctrl+Shift+S. Navigate to the directory where you want to store the file.
Execute an SQL statement
Place the cursor within the statement.
Press Ctrl+Enter. Alternatively, click 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 SQL files from the editor window
Double-click an SQL file to open it in PhpStorm.
Right-click the code in the editor and select Attach Console.
Select a console file that you want to use.
Click the Run icon (Shift+F10).
Select statements that you want to execute and press Enter.