What is the difference between ' OR ' and ' || 'in postgreSQL?

SQL:

 select distinct(us.email), us.id from users us left join aliases al on al.user_name like us.email `||` '_%' where us.email; 

Sql pulls different data depending on whether it is OR or || . Why?

  • 7
    Give a working example with OR. because OR is a logical operator. A || is a string concatenation. If you put OR in your example, then there will be a syntax error - Mike
  • In MySQL, OR is also a logical operator, and || too concatenation? - Giovanni
  • one
    @Mike, in my opinion, Giovanni is right dev.mysql.com/doc/refman/5.7/en/ ... in MySQL bitwise OR, this is |, and OR and || - synonyms. - cheops

0