DataGrip是JetBrains公司推出的管理資料庫的產品,對於JetBrains公司,開發者肯定都不陌生,IDEA和ReSharper都是這個公司的產品,使用者體驗非常不錯。
下載地址:www.jetbrains.com/datagrip/
所謂工欲善其事,必先利其器,如果用好了一款開發軟體,將大大提升我們的工作效率。
那麼接下來,我們就講解下DataGrip的使用方法。
1.配置Data Source
既然是管理資料庫,第一步肯定是要先配置以下資料來源,如Dev環境,QA環境的資料庫伺服器,配置方法如下所示:






以上是以Microsoft SQL Server為例,如果是連線MySQL資料庫,方法類似。
2.新建表
在要新增表的資料庫上右鍵,然後按如下圖操作:


3.生成建立某張表的指令碼
假如我們在Dev環境建立了一張表,提測到QA環境時,測試要求提供指令碼,但是你又沒有儲存,此時可以使用SQL Generator自動生成建立表的指令碼:


4.新建查詢視窗(console)
運算元據庫時,平時最常用的肯定就是查詢視窗了,我們會查詢資料分析問題,會寫一些SQL指令碼,那麼在DataGrip中如何新建console呢?



小技巧:如果希望生成的關鍵字都是SELECT,FROM這種全大寫的,輸入第一個字母時,輸入大寫的,這樣選擇完智慧提示的關鍵字,就是全大寫的。
5.設定長SQL語句自動換行
在查詢視窗中,有時SQL語句會很長,拖動水平滾動條檢視會很不方便,此時就可以設定SQL語句自動換行:

注意:該設定不是全域性的,只是針對當前活動的console。