From dc7159c16c4683b29968f0d49fe60f1fb780d25e Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sun, 27 Oct 2024 22:45:13 -0500 Subject: [PATCH] Add a bit more to the latest TIL --- postgres/concatenate-strings-with-a-separator.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/postgres/concatenate-strings-with-a-separator.md b/postgres/concatenate-strings-with-a-separator.md index 0817c75..b880149 100644 --- a/postgres/concatenate-strings-with-a-separator.md +++ b/postgres/concatenate-strings-with-a-separator.md @@ -39,3 +39,15 @@ create table folders ( The first argument to `concat_ws` is the separator I want to use. The remaining arguments are the strings that should be concatenated with that separator. + +One other things that is nice about `concat_ws` is that it will ignore `null` +values that it receives. + +```sql +> select concat_ws(':', 'one', 'two', null, 'three'); ++---------------+ +| concat_ws | +|---------------| +| one:two:three | ++---------------+ +```