Code insight

DataGrip makes your SQL coding as easy and effective as possible. It completes keywords and identifiers, generates SQL, detects probable bugs in your SQL code and suggests the best options to fix them on the fly.

Intention Actions

As soon as DataGrip finds a way to alter your code, you can apply it by pressing Alt+Enter. You’ll see the pop-up with Intention Actions, which cover a wide range of situations from warnings to optimization suggestions. Some of the most useful ones include:

  • Create a table definition from INSERT statement
  • Qualify/unqualify identifier
  • Quote/unquote identifier
  • Expand wildcard
  • Introduce alias for the subquery
  • Add a missing object to the database
  • Convert many AND operators to one IN operator

Code completion

Code completion is pretty fast in DataGrip. You get a list of suggestions as you type: our main goal is zero-latency here. Completion is automatic, but you can invoke it at any moment by pressing Ctrl+Space. It is also context-aware, which means that it tries to only suggest the objects and keywords you may need at any particular moment.

Learn more about code completion.

Inspections: errors

DataGrip detects probable bugs in your SQL code and suggests the best options to fix them on the fly. The IDE will notify you if there are:

  • Unresolved objects: invalid objects in a query
  • Ambiguous names in a query
  • Mismatching number of columns in queries used in set operators
  • Mismatching number of values in INSERT statement
  • The cursor you use is not opened

Inspections: warnings

Sometimes your code works but contains something that shouldn’t be there. DataGrip will warn you in case of:

  • Unused parameters in procedure or function
  • Unused subquery items
  • Unreachable code
  • Constant conditions in WHERE clause
  • Unsafe statements you are going to run
  • Possible truncation of the string

Expand wildcard

Since using wildcards is not recommended in many cases, DataGrip can expand it to list all columns of the table for you. In the case of conflicts, identifiers will be qualified.

Parameter info

DataGrip can give you information about the names and types of parameters for functions and procedures as well. To see this tooltip press Ctrl+P.

Column names tooltip for INSERT statement

To assist you in inserting valid values, the IDE hints at the name and type of corresponding columns. Invoke it by pressing Ctrl+P.

Column names hints for INSERT statement

Try enabling Settings → Editor → General → Appearance → Show parameter name hints: DataGrip will prompt you with information about the column names in INSERT statements.