login

SQL CONCAT Function

SQL CONCAT() function is used to concatenate two or more strings. MySQL allows you concatenate more than two strings while other force exactly two. Here is the syntax:

	CONCAT(expression)

Here is the query to concat employee name and his salary in MySQL:

SELECT CONCAT(name,':',salary) as name_salary
FROM employees

Here is the output:

name_salary     
----------------
jack:3000.00    
mary:2500.00    
newcomer:2000.00
anna:2800.00    
Tom:2700.00     
foo:4700.00