Concatenation combines two or more string values into one value. It solves a common reporting task: joining pieces such as a first name and last name or a title and review message. section 15.1
Join first and last names
SELECT CONCAT(FirstName, ' ', LastName) AS AuthorName FROM author; CONCAT receives comma-separated values. The space is included as its own value, so the two column values appear as one readable name. section 15.1.1
Do not assume that the plus sign joins strings. In MySQL, adding string values can produce 0 because the expression is treated as a mathematical calculation. SQL Server supports plus for strings, but the approach is not portable across most relational database systems. section 15.1
CONCAT also supports nearby reporting tasks:
- Combine a title with a reusable message, such as a title name followed by “is a great book!”. section 15.1.1
- Combine numeric or date values with strings, remembering that CONCAT converts every value to a string. section 15.1.1
- Sort by the original numeric column when concatenated output must retain numeric ordering; sorting the combined text can place 10.95 before 7, 8, or 9. section 15.1.1
SELECT CONCAT(FirstName, ' ', LastName) AS AuthorName FROM author;
Inspect a complete CONCAT query that turns FirstName and LastName columns into one AuthorName value. section 15.1.1









