简体   繁体   English

选择 concat(first_name,' ',last_name) 作为员工的“全名”---在 oracle 中连接 2 列时如何带空间---

[英]select concat(first_name,' ',last_name) as "full name "from employees ---how to bring space when 2 columns are concatenated in oracle---

select concat(first_name,' ',last_name) as "full name "from employees

Oracle's CONCAT function takes only two arguments. Oracle 的CONCAT函数只接受两个参数。 So if you wanted to continue along with your exact current approach, you would have to chain together two calls to CONCAT :因此,如果您想继续使用当前的确切方法,则必须将两个对CONCAT调用链接在一起:

SELECT CONCAT(CONCAT(first_name, ' '), last_name) AS "full name"
FROM employees;

Or, you could just use the ANSI standard concatenation operator ||或者,您可以只使用 ANSI 标准连接运算符|| :

SELECT first_name || ' ' || last_name AS "full name"
FROM employees;

Use the operator ||使用运算符|| :

select (first_name || ' ' || last_name) as full_name
from employees

Check the below using ||使用||检查以下内容

 select first_name || ' ' || last_name as "full name" from employees;

If you want to use CONCAT operator you can try the below:如果您想使用CONCAT运算符,您可以尝试以下操作:

SELECT CONCAT(CONCAT(first_name , ' '),LAST_NAME) AS "full name"
      FROM employees;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如有空格,如何将NAME分为3个不同的字段FIRST_NAME,MIDDLE_NAME和LAST_NAME - How to split NAME into 3 different fields FIRST_NAME, MIDDLE_NAME & LAST_NAME when there is a space 从员工中选择 first_name,length(trim(FIRST_NAME)) 作为 lengthOfName_without_space; - select first_name,length(trim(FIRST_NAME)) as lengthOfName_without_space from employees; 使用 Reg_exp 从电子邮件预言机中提取名字和姓氏 - Extracting First_name & Last_name from email oracle using Reg_exp 试图在 Oracle SQL 中将 FULL_NAME 分成 FIRST_NAME 和 LAST_NAME,但它没有显示表本身的任何更改 - Trying to separate a FULL_NAME into FIRST_NAME and LAST_NAME in Oracle SQL, but it does not show any changes on the table itself 通过First_Name和/或Last_Name查询sql表 - query sql table By First_Name and/or Last_Name 在Ruby on Rails 3中合并first_name和last_name列的最佳方法? - Best way to combine first_name and last_name columns in Ruby on Rails 3? 如何使用sql查询组合first_name和last_name? - How to combined first_name and last_name using sql query? PHP-如何在登录后获取正确的名字和姓氏? - PHP - How to get correct first_name and last_name after login? 具有名称,名字和姓氏的PostgreSQL多表查询 - PostgreSQL multi-table query with name, first_name, and last_name 有一种方法可以将%(sql)放入Java。 像这样“从员工的名字中选择“名字”,例如“ A%e”” - There's a way to put % (sql) in java. Like this “select first_name from employees where first_name like 'A%e'”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM