DataGrip is the database management software from JetBrains. DataGrip supports almost all major relational database products. Such as DB2, Derby, H2, MySQL, Oracle, PostgreSQL, SQL Server, Sqllite, Sybase, and so on, and provide a simple and easy to use interface, developers will have almost no difficulty getting started.



Next, administer the database driver. DataGrip supports mainstream databases, File->DataSource

You can also expand the green + sign in the Database view to add a Database connection

Select the type of database you want to connect to



In panel, upper part lists the established database connection, click on the, on the right side will display the current connection configuration information, General panel, you can configure the database connection information, such as host, username, password, etc., different database configuration information not completely the same, fill in the database URL, note that the URL option, You can choose to enter the URL directly, so you don’t need to enter the host name, port, etc.

The Driver section displays database Driver information. If the Driver has not been downloaded, there is a warning at the bottom indicating that the Driver is missing



Click the database type after Driver to jump to the Driver download page, click Download, after downloading the Driver package will be displayed





If there is a problem with the downloaded driver, you can manually add the local driver package. In the trial process, when creating an Oracle connection, the downloaded driver package has a problem, indicating that the class is missing. Click the green + sign on the right, select the locally downloaded JAR package, and move the imported JAR package to the top position through the right up and down arrow



Click Test Connection to see if the configuration is correct, and you are ready to use it.

Open DataGrip, select File->Settings, the current panel displays the common Settings



Basically the default setting is enough, and it is very easy to change the Settings, the left side menu has been classified well, the first is the configuration database related, the second is to configure the appearance, here you can modify the theme, the key map modify shortcuts, editor configuration Settings editor, here you can change the font editor, open the edit item, Editor->Color & Fonts->Font



Next, we use DataGrip to perform common database operations, including querying data, modifying data, creating databases, tables, and so on.

The upper left area shows the current database connection. After the expansion, the database table information is displayed. If no information is displayed after the expansion, select the database connection and click the rotation icon to synchronize it.

Right-click the database connection and select Open Query Console to write the SQL statement in the console on the right.

After writing the SQL statement, you can select the green arrow on the upper left side of the electronic execution



You can also use the Shortcut key Ctrl+Enter. If selected, the SQL will be executed directly. If unchecked, if there are multiple SQL entries in the console, the system will prompt you to select which SQL to execute. If the width of a column is too narrow, you can click on any column and use Ctrl+Shift+ left arrow to adjust the width. To adjust the width of all columns, click on the red box in the upper left corner, select all rows and use Ctrl+Shift+ left arrow to adjust the width. The + and – buttons at the top can directly add rows or delete selected rows. Editing columns is also very convenient. Double-click the column to be modified, enter the modified value, and click in other parts of the mouse to complete the modification



If you want to see the results in a new TAB, click the Pin TAB button. If you want the results to be displayed in a new TAB, click the pin TAB button. The new query will no longer be displayed in the current TAB, but will open a new TAB



To create a new table, select the database connection, click the green + sign and select Table. In the new window, you can fill in the table information



You can fill in the table name and comment at the top, click the green + sign on the right to add columns in the middle, and column type can be automatically completed. Click the message block icon on the right of default to add comments to columns, and the next TAB can set indexes and foreign keys. All the DDLS of these operations will be directly displayed at the bottom

After the table is created, you can click the table icon in the following figure to open the table and view it



Table Diagrams: Right click on the table name -> Diagrams-> Show Visualisation (Shortcut: Ctrl+Alt+Shift+U)



DataGrip’s export capability is also quite powerful

Right-click the table that you want To export Data from, and select Dump Data To File



You can export SQL statements in the form of INSERT and UPDATE, and data in the form of HTML, CSV, and JSON

You can also export it in the query result view

Click the download icon in the upper right corner. In the pop-up window, you can select different export methods, such as SQL INSERT, SQL Update, CSV format, and so on



If it is exported to a CSV format, you can control the format of the export



This is what happens when you export it and open it in Excel



Import data

Select the table, right-click ->Import from File, and select the File to Import



Note that if you check the two header options on the left when exporting, you should also check if there are headers when importing, otherwise you will be prompted that the number of columns does not match

Keyword navigation:

When writing SQL in the text editing area of the Datagrip, hold down the keyboard Ctrl key and move the mouse over the SQL keyword, such as table name, field name, or function name. The mouse will turn into a hand shape, the keyword will turn blue and underline, and click to automatically locate the left object tree and select the object to be clicked on



Quick navigation to specified tables, views, functions, and so on:

In datagrip, use the Ctrl+N shortcut to bring up a search box, type the name you want to navigate to, and press Enter

Global search

Hold down the Shift key twice in a row, or click the search icon in the upper right corner of the mouse to bring up the search box for anything you want to search

Result set search

In the query result set view area, click and press Ctrl+F. In the displayed search box, enter the search content. Regular expressions and filter results are supported



Navigate to associated data

Table between the external inspection association, query, can directly locate to the associated data, or the associated data, such as user1 table has a external inspection field classroom pointing to the primary key ID of the classroom table, in query table data, you can right-click on the ID field, go to, Referencing data to determine whether to display the first data or all of it

Result set data filtering

For a result set opened with Table Edit (select the table in the object tree, right click -> Table Editor), you can continue filtering the result set with a condition, as shown in the figure below, by entering the WHERE condition filter in the upper left input section of the result set

You can also right-click the column to filter data, filter by

Transfer line column

For a table with a large number of fields, the data can be viewed left and right by switching to columns and using the Ctrl+Q shortcut in the result set view area

Variable renaming

Click the variable you want to rename, press Shift+F6 shortcut key, pop-up rename dialog box, enter a new name

Automatically detects objects that cannot be parsed

If the table or field name does not exist, datagrip will automatically prompt you to create a table or add a field by pressing Alt+Enter

The permission determines the field name

Datagrip automatically adds prefixes to fields that do not have aliases. Hover over the field and use Alt+Enter



* Automatic expansion of wildcards

When querying, we use select to query all columns, which is a bad habit, but datagrip can quickly expand the columns, place the cursor behind them, and press Alt+Enter



Automatic uppercase conversion

It is a good habit to use uppercase SQL. If lowercase is used, hover the cursor over the field or table name you want to convert and use the Ctrl+ Shift +U shortcut to automatically convert it

SQL formatting

Select the SQL code you want to format and use the Ctrl+Alt+L shortcut key

Datagrip provides a powerful editor that implements notpad++ column editing mode

Multi-cursor mode

When editing SQL, you may need to enter or delete some characters at the same time. Holding Down Alt + Shift and clicking the mouse in different positions will cause multiple cursors to appear

Intelligent code

Completion DataGrip provides context-specific code completion to help you write SQL code faster. Complete the ability to recognize table structures, foreign keys, and even database objects created in the code you’re editing.



Instant analysis and quick fixes

DataGrip detects possible errors in the code and suggests the best options to fix them dynamically. It immediately lets you know about unresolved objects, uses keywords as identifiers, and always provides a way to resolve the problem.



The complete SQL log, you will now see each query that DataGrip runs in the console output. Whether it’s something your SQL or DataGrip needs to run internally, see the Output TAB to see what’s going on.



Second, all queries from the IDE are now recorded in a text file. To open the file, please go to “help” | Show SQL Log in

Explorer(C:\Users\31277\AppData\Local\JetBrains\DataGrip2020.1\database-log\ database file)





Code comments

To comment the code or uncomment it, select the code to comment and press Ctrl+/ or Ctrl+ Shift +/



Column editor

Hold down the Alt key on the keyboard and hold down the left mouse button to drag. You can select multiple columns, copy and paste, and other operations