Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

What does || do in SQL?

SELECT 'a' || ',' || 'b' AS letter
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
630 views
Welcome To Ask or Share your Answers For Others

1 Answer

|| represents string concatenation. Unfortunately, string concatenation is not completely portable across all sql dialects:

  • ansi sql: || (infix operator)
  • mysql: concat ( vararg function ). caution: || means 'logical or' (It's configurable, however; thanks to @hvd for pointing that out)
  • oracle: || (infix operator), concat ( caution: function of arity 2 only ! )
  • postgres: || (infix operator)
  • sql server: + (infix operator), concat ( vararg function )
  • sqlite: || (infix operator)

hopefully the confusion is complete ...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...