Why "||" is used as string concatenation in PostgreSQL/Redshift [closed] Why "||" is used as string concatenation in PostgreSQL/Redshift [closed] postgresql postgresql

Why "||" is used as string concatenation in PostgreSQL/Redshift [closed]


-- DB2 / Oracle / Postgres / ANSI StandardSELECT first_name || ' ' || last_name As full_name FROM customers;-- Sybase / SQL Server / Microsoft AccessSELECT FirstName + ' ' + LastName As FullName FROM Customers;-- MySQLSELECT CONCAT(`FirstName`, ' ', `LastName`) As `FullName` FROM `Customers`;

Double pipe concatenation is part of the ANSI SQL standard. SQL was initially developed at IBM deep in the mainframe era. Most of the "major programming languages" you are thinking of did not exist when SQL was created. Most modern languages are "C like" on some level but FORTRAN77, for example, uses // as it's concatenation operator.