sqlcmd.net validated sql reference
beginner string-processing MySQL MariaDB SQL Server PostgreSQL SQLite

Join Text Values With Hyphens

Combine multiple text values into one hyphen-separated key-like string.

Docker-validated Not currently validation-green

Join three ordered key parts with hyphens

This is the lightweight version of slug or key building: preserve the order of the text fragments, then join them with the separator you want in the final key.

Shared across supported engines.
SQL
SELECT
  CONCAT ('structure', '-', 'outlives', '-', 'query') AS retained_key;
Returned rows for the shared example.
retained_key
structure-outlives-query

The fragments are joined left to right with one hyphen between each value.

Where this command helps.

  • building a retained record key from several metadata values
  • creating a readable slug from ordered text fragments

What the command is doing.

Hyphen-joined text is common when building slugs, retained record keys, or human-readable identifiers. The main job is simple: keep the values in order and place one hyphen between them.