SQL String Concatenation (||)
The operator form of joining text together — shorter to type than CONCAT, but propagates NULL through the whole expression.
What & Why
The || operator joins text values together, functioning like CONCAT for ordinary values — the difference only shows up when NULL is involved, covered in the previous lesson.
See How It Works
BUSINESS QUESTION
Product wants a readable feature and team label.
| id | name | description | team | released_at | deprecated_at |
|---|---|---|---|---|---|
| 1 | Activation Checklist | Guides new users through setup | growth | 2024-01-20 | NULL |
| 2 | CSV Export | Exports report data | platform | 2024-02-14 | NULL |
| 3 | Invite Nudges | Prompts workspace collaboration | growth | 2024-03-05 | NULL |
| 4 | Legacy Dashboard | Original reporting surface | analytics | 2023-08-10 | 2024-06-01 |
EXAMPLE QUERY
SELECT
id AS feature_id,
name || ' — ' || team AS feature_label
FROM product.features
ORDER BY feature_id;RESULT — exact output from the displayed Queryflo rows
| feature_id | feature_label |
|---|---|
| 1 | Activation Checklist — growth |
| 2 | CSV Export — platform |
| 3 | Invite Nudges — growth |
| 4 | Legacy Dashboard — analytics |
The concatenation uses each displayed feature name and team.
Sign up free to try it on a real business scenario