MySQL concatenation operator(MySQL 连接运算符)

本文介绍了MySQL 连接运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道 MySQL 的连接运算符.

I don't know concatenation operator for MySQL.

我已经尝试使用此代码进行连接:

I have tried this code for concatenation:

SELECT vend_name || ' (' || vend_country || ')'
FROM Vendors
ORDER BY vend_name;

但是没有用.我应该使用哪个运算符来连接字符串?

But it didn't work. Which operator should I use to concatenate strings?

推荐答案

您正在使用 ORACLE 类型的串联.MySQL的应该是

You were using ORACLE type of concatenation. MySQL's Should be

 SELECT CONCAT(vend_name, '(', vend_country, ')')

调用 CONCAT() 函数并用逗号分隔您的值.

Call the CONCAT() function and separate your values with commas.

这篇关于MySQL 连接运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!