Skip to content

SQL snippets and formatting ​

Snippets are ready-to-insert SQL templates. Formatting applies a consistent presentation to the code.

Snippets ​

A snippet contains:

  • an identifier;
  • a name;
  • a target Firebird version;
  • a description;
  • the SQL.

Usage ​

In the SQL editor:

  1. choose a snippet from the list;
  2. the template is inserted at the cursor position;
  3. fill in the parameters.

Snippets are filtered according to the version of the open database.

Library ​

Tools > SQL snippets opens the library:

  • create;
  • duplicate;
  • edit;
  • delete;
  • reset the built-in templates.

Storage is local to the FbExpert server.

Formatting ​

The Format button applies the current options:

  • keyword capitalization;
  • indentation;
  • line breaks;
  • column alignment;
  • comma style.

The options are available under Options.

Example ​

Before:

sql
select c.id,c.name from customers c where c.name like 'A%' order by c.name;

After:

sql
SELECT
    c.id,
    c.name
FROM customers c
WHERE c.name LIKE 'A%'
ORDER BY c.name;

Best practices ​

  • one snippet per use case;
  • state the Firebird version;
  • test the snippet before sharing it;
  • do not store secrets in a snippet.