Last updated: 2026-02-12

SQL Snippets

SQL snippets let you quickly insert common code patterns. Type a short prefix, press Tab, and a full template expands with placeholders you can fill in. Create your own snippets for frequently used queries.

Using Built-in Snippets

Jam SQL Studio includes snippets for common SQL operations.

Triggering a Snippet

  1. Start typing a snippet prefix in the query editor (e.g., sel)
  2. The snippet appears in the autocomplete dropdown
  3. Press Tab or Enter to expand the snippet
  4. Fill in the placeholder values
  5. Press Tab to move to the next placeholder
Snippet appearing in autocomplete dropdown when typing sel.
Snippet appearing in autocomplete dropdown when typing "sel".

Working with Placeholders

After a snippet expands, use these keys to navigate:

  • Tab - Move to next placeholder
  • Shift+Tab - Move to previous placeholder
  • Escape - Exit snippet mode and place cursor at end
Expanded snippet with active placeholder ready for input.
Expanded snippet with active placeholder ready for input.

Built-in Snippet Library

Jam SQL Studio includes these snippets out of the box:

Query Snippets

PrefixDescriptionExpands To
selSELECT statementSELECT * FROM table_name
selcSELECT with columnsSELECT column1, column2 FROM table_name
selwSELECT with WHERESELECT * FROM table_name WHERE condition
seltSELECT TOPSELECT TOP 100 * FROM table_name
insINSERT statementINSERT INTO table_name (columns) VALUES (values)
updUPDATE statementUPDATE table_name SET column = value WHERE condition
delDELETE statementDELETE FROM table_name WHERE condition

Join Snippets

PrefixDescriptionExpands To
ijINNER JOININNER JOIN table2 ON table1.column = table2.column
ljLEFT JOINLEFT JOIN table2 ON table1.column = table2.column
rjRIGHT JOINRIGHT JOIN table2 ON table1.column = table2.column
cjCROSS JOINCROSS JOIN table2

DDL Snippets

PrefixDescriptionExpands To
ctCREATE TABLEFull CREATE TABLE template with columns
cvCREATE VIEWCREATE VIEW view_name AS SELECT ...
cpCREATE PROCEDUREFull stored procedure template
cfCREATE FUNCTIONScalar function template
ciCREATE INDEXCREATE INDEX index_name ON table (columns)

Creating Custom Snippets

Define your own snippets for frequently used patterns.

Add a New Snippet

  1. Open Settings (Cmd+, / Ctrl+,)
  2. Navigate to Snippets
  3. Click Add Snippet
  4. Enter a unique prefix
  5. Add a description
  6. Write the snippet template code
  7. Click Save
Snippets management in settings showing custom snippet editor.
Snippets management in settings showing custom snippet editor.

Placeholder Syntax

Use these patterns in your snippet templates:

SyntaxDescriptionExample
${1}Simple tab stopCursor stops here, no default text
${1:text}Tab stop with default${1:table_name} shows "table_name" selected
${2:text}Second tab stopTab moves to this after first
$0Final cursor positionWhere cursor ends after all tab stops

Example Custom Snippet

A snippet for audited INSERT statements:

-- Prefix: insa
-- Description: INSERT with audit columns

INSERT INTO ${1:table_name} (
    ${2:columns},
    CreatedBy,
    CreatedAt
)
VALUES (
    ${3:values},
    CURRENT_USER,
    GETDATE()
)$0

When expanded:

  1. Cursor highlights table_name for you to replace
  2. Tab moves to columns
  3. Tab moves to values
  4. Tab exits snippet mode with cursor at end

Managing Snippets

Edit Snippets

Click the pencil icon next to any custom snippet to edit its prefix, label, description, or template code.

Delete Snippets

Click the trash icon next to a custom snippet to delete it. A confirmation dialog will appear before deletion.

Clear All Snippets

Use the Clear [Engine] snippets button to remove all custom snippets for a specific database engine (SQL Server, PostgreSQL, or SQLite).

Ready to Speed Up Your SQL Writing?

Download Jam SQL Studio and start using snippets today.