In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to use DataGrip database tools. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Recently I saw a database client tool, DataGrip, which is produced by the famous JetBrains company, which is the company that produces Intellij IDEA. DataGrip is a database management client tool that makes it easy to connect to a database server, perform sql, create tables, create indexes, and export data. The client tool I tried before was dbvisualizer, but after I tried DataGrip, I decided to abandon dbvisualizer. I believe that when you first see DataGrip, there will be an amazing feeling, just like the first time you see a girl, just a glance, you say to yourself, it is her! Needless to say, let's take a look at the common functions of DataGrip. The DataGrip download link is as follows: https://www.jetbrains.com/datagrip/download. The installation process is also very simple, double-click the installation, the next step, the middle will let you choose the theme, I choose the classic Darcula, after the installation is complete, start, the interface is as follows
I believe that students who have used IDEA will feel very friendly. Next, manage 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 to which you need to connect
In the panel, the upper left part lists the established database connections. Click on each item, and the right side will show the configuration information of the current connection. In the General panel, you can configure the database connection information, such as host, user name, password, etc., different database configuration information is not exactly the same. Enter the database URL. Note that there is an option after URL, you can choose to enter url directly. Then you don't need to fill in the host name, port and other information separately.
The Driver section displays the database driver information. If the driver has not been downloaded, there will be a warning at the bottom indicating that the driver is missing.
After clicking on the database type of Driver, you will jump to the driver download page, click download, and the driver package will be displayed after download.
If there is a problem with the downloaded driver, you can manually add the local driver package. During the trial, when creating an Oracle connection, the downloaded driver package has a problem, prompting the lack of class, click the green + sign on the right, select the locally downloaded jar package, and move the imported jar package to the top location through the right up and down arrow to OK.
Click Test Connection to see if the configuration is correct, and then you can use it.
Open DataGrip and select File- > Settings. The current panel shows common settings.
Basically, the default setting is enough, and it is easy to change the settings. The left menu has been classified. The first item is the database-related configuration, and the second item is the configuration appearance. Here you can modify the theme, key map modify shortcut keys, editor configuration editor related settings, here you can modify the editor font, expand the edit item, Editor- > Color & Fonts- > Font.
You need to save the current theme, click save as, name it, and select the renamed theme to modify it. Here I choose the accustomed Conurier New font, size 14, click apply in the lower right corner, and click OK.
There's nothing else to set up.
Next, we use DataGrip to complete common database operations, including querying data, modifying data, creating databases, tables, and so on.
The upper left area shows the current database connection, and database tables and other information will be displayed after expansion. If you do not have any information after the expansion, you need to select the database connection, click the rotation icon above to synchronize it, and there is a More Schema option below. Click to switch different schema.
Right-click the selected database connection, select open console, and you can write sql statements in the console on the right.
DataGrip smart prompt is very cool, whether it is the standard sql keyword, or table name, field name, or even database-specific fields, can prompt, have to sigh that this smart prompt is too powerful, Intellij IDEA smart prompt is also second kill eclipse.
After writing the sql statement, you can select the green arrow on the upper left side of the electronic to execute.
You can also use the shortcut key Ctrl+Enter. If selected, the sql will be executed directly. If there is more than one sql in the console, it will prompt you which sql to execute. Get used to the operation in dbvisualizer before, the cursor in dbvisualizer hovers over the current sql (sql ends with a semicolon), press Ctrl+. Shortcut keys automatically execute the current sql. In fact, DataGrip can also be set in setting- > Database-General.
The default is the prompt when the statement is executed, and when the cursor hovers over the current statement when it is changed to smallest statement, pressing Ctrl+Enter will execute the current statement directly.
The execution result of the statement is displayed at the bottom
If the width of a column is too narrow, you can click any one of the columns, use the shortcut key Ctrl+Shift+ left and right arrow to adjust the width, if you want to adjust the width of all columns, you can click on the red box in the upper left corner, select all rows, and use the shortcut key Ctrl+Shift+ to adjust the left and right arrows
It is also convenient to add and delete rows. The + and-buttons on the top can directly add rows or delete selected rows, and it is also convenient to edit columns. Double-click on the column to be modified, enter the modified value, and click on other parts of the mouse to complete the modification.
Sometimes we want to set a field to null, not an empty string "". DataGrip also provides gradient operation. Right-click on the column directly and select set null.
For those who need multiple windows to view the results, that is, if you want the query results to be displayed in the new tab, you can click the pin tab button, and the new query will not be displayed in the current tab, but will open a new tab.
The output console next to it displays the log information of the execution of sql, and you can see the time of execution of sql and other information.
I asked such a hanging tool, who else!
To create a new table is also quite simple and intelligent. Select the database connection and click the green + sign to select table.
In the newly opened window, you can fill in the form information
I asked you if you were excited to see this window!
At the top, you can fill in the table name and table comments, and in the middle, you can click the green + sign on the right to add the column, and the column type type can also be completed automatically. The message box icon on the right side of default can add comments to the column after clicking, and several tab next to it can set indexes and foreign keys.
The DDL of all these operations will be displayed directly at the bottom.
I'll ask you if you're scared.
After the table is built, you can click the table icon in the following figure to open the table to view the view.
You can view the data of a table, or you can view DDL statements
The design and experience of these basic functions have been amazing to me, and then there is the export of data.
The export function of DataGrip is also quite powerful.
Select the table for which you want to export data, right-click, Dump Data To File
You can export sql statements in the form of insert and update, as well as data in html, csv and json formats
Can also be exported in the query results view
Click the download icon in the upper right corner, and you can choose different export methods in the pop-up window, such as sql insert, sql update, csv format, etc.
If you are exporting to csv format, you can also control the format of the export.
This is the result of opening it with excel after export.
In addition to exporting data, you can also import data
Select the table, right-> Import from File, and select the file to import
Note that if the two header options on the left are checked when exporting, and if there is header when importing, it should also be checked, otherwise it will prompt that the number of columns does not match.
1. Keyword navigation:
When writing sql in the text editing area of datagrip, hold down the Ctrl key of the keyboard and move the mouse over the sql keyword, such as table name, field name, or function name, the mouse will become hand-shaped, the keyword will turn blue, and it will be underlined. Click, it will automatically navigate to the left object tree and select the object you click on.
2. Quickly navigate to the specified table, view, function, etc.:
In datagrip, use the Ctrl+N shortcut key to pop up a search box, enter the name you need to navigate, and enter enter.
3. Global search
Press the shift key twice in a row, or click the search icon in the upper right corner and pop up the search box to search for anything you want to search
4. Result set search
Click the mouse in the query result set view area, press the Ctrl+F shortcut key, pop up the search box, enter the search content, support regular expressions, filter the results
5. Navigate to the associated data
There will be an external inspection association between the tables. When querying, you can directly locate the associated data or the associated data. For example, the user1 table has an external check field classroom that points to the primary key id of the classroom table. When querying classroom table data, you can right-click on the id field and go to,referencing data.
Choose whether you want to display the first piece of data or all data
Automatically opens the data of the associated table
On the contrary, when querying the data of the word table, it can also be automatically located to the parent table.
6. Result set data filtering
For the result set opened using table edit (selected table in the object tree, right-> table editor), you can continue to filter the result set using conditions. As shown in the following figure, you can enter where conditional filtering in the input section in the upper left corner of the result set.
You can also right-click on the columns that need to filter data and filter by filter.
7. Rows and columns
For tables with more fields, you need to push the data left and right, switch to column display, and use the Ctrl+Q shortcut key in the result set view area
1. Rename the variable
Click on the variable that needs to be renamed, press the Shift+F6 shortcut key, pop up the rename dialog box, and enter a new name
2. Automatically detect objects that cannot be parsed
If the table name or field name does not exist, datagrip will automatically prompt you. Pressing Alt+Enter for the table or field name in question will automatically prompt you whether to create the table or add a field.
3. Permission field name
For queries that use table aliases but do not use alias prefixes in fields, datagrip can automatically add prefixes, mouse over fields that need to add alias prefixes, and use Alt+Enter shortcuts
4. * wildcards are automatically expanded
When querying, we will use select * to query all columns, which is a bad habit. Datagrip can quickly expand the columns, position the cursor behind *, and press the Alt+Enter shortcut key.
5. Automatic uppercase conversion
It is a good habit for sql to use uppercase. If lowercase is used, you can pause the cursor over the field or table name that needs to be converted, and use the Ctrl+shift+U shortcut to convert automatically.
6. Sql format
Select the sql code that needs to be formatted and use the Ctrl+Alt+L shortcut key
Datagrip provides a powerful editor that implements the column editing mode of notpad++
1. Multi-cursor mode
When editing sql, you may need to enter or delete some characters at the same time, press alt+shift, and click in different locations at the same time, multiple cursors will appear
2. Code comments
Select the code you want to comment and press the Ctrl+/ or Ctrl+shift+/ shortcut key to comment the code or uncomment it
3. Column editing
Hold down the keyboard alt key, while pressing the left mouse button to drag, you can select multiple columns, copy paste and other operations
4. Code history
In the text editor, mail, local history,show history, you can view the history of used sql
Command history
Thank you for reading! This is the end of this article on "how to use DataGrip database tools". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.