DataGrip provides code completion based on the context and schema constraints, helping you write SQL code faster. Let’s have a look at the most important code completion features.
Foreign keys aware
The IDE can complete your whole
JOIN statement if the tables are connected with a
When you write
INSERT statements, listing all the fields takes a lot of work.
DataGrip completion can relieve you of this responsibility by generating the list automatically.
If you have names in
just use the first letters of the words — it’s all you need, the rest will be completed with the
Hippy (nobody knows why it's called this) completion with Alt+/ cyclically completes words by matching the typed letters to the words in open files.
Qualifying objects in completion is the feature to bet on, set it up in Settings → Editor → Smart
Keys. There are three options: Never, Always and On collisions and
here’s how they work. Suppose we have two schemas,
public: The table
actor is present in both
schemas and the table
actor_1 is only in
public. Here is
an example of Qualify on collisions:
Keyboard layout aware
A feature for those who use many languages: DataGrip understands what you mean, even if you forgot to switch the input language.
This type of completion may be familiar if you’ve used other IntelliJ-based IDEs before. It is especially useful when the logic of how the code should be written is opposite
to the real-life one. For example, if you type
table_name.afrom you will get the list of all the table’s columns. Or, typing
identifier.cast will generate the casting code
for you. Here is a movie of how all of them work:
When the query console contains a DDL statement with a
ALTER clause, code completion is aware of the changes you have in this DDL.
DataGrip can offer you an alias for the object. This completion is not automatic: invoke it with Ctrl+Space.