Code completion

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 foreign key.

INSERT statement

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.

Abbreviation

If you have names in camelCase or objects-with-hyphenated-names, just use the first letters of the words — it’s all you need, the rest will be completed with the suggestion.

Hippy

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

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, makila and 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.

ALTER statement aware

When the query console contains a DDL statement with an ALTER clause, code completion is aware of the changes you have made in this DDL.

Aliases

DataGrip can offer you an alias for the object. This completion is not automatic: invoke it with Ctrl+Space.