当前位置:网站首页>【sql】SQL32 将employees表的所有员工的last_name和first_name拼接
【sql】SQL32 将employees表的所有员工的last_name和first_name拼接
2022-04-21 20:59:00 【不爱研究的研究僧】
题目:
将employees表的所有员工的last_name和first_name拼接起来作为Name_牛客题霸_牛客网
现有员工表employees如下:
| emp_no | birth_date | first_name | last_name | gender | hire_date |
| 10001 | 1953-09-02 | Georgi | Facello | M | 1986-06-26 |
| 10002 | 1964-06-02 | Bezalel | Simmel | F | 1985-11-21 |
| 10003 | 1959-12-03 | Parto | Bamford | M | 1986-08-28 |
| 10004 | 1954-05-01 | Chirstian | Koblick | M | 1986-12-01 |
| 10005 | 1955-01-21 | Kyoichi | Maliniak | M | 1989-09-12 |
| 10006 | 1953-04-20 | Anneke | Preusig | F | 1989-06-02 |
| 10007 | 1957-05-23 | Tzvetan | Zielinski | F | 1989-02-10 |
| 10008 | 1958-02-19 | Saniya | Kalloufi | M | 1994-09-15 |
| 10009 | 1952-04-19 | Sumant | Peac | F | 1985-02-18 |
| 10010 | 1963-06-01 | Duangkaew | Piveteau | F | 1989-08-24 |
| 10011 | 1953-11-07 | Mary | Sluis | F | 1990-01-22 |
请将employees表的所有员工的last_name和first_name拼接起来作为Name,中间以一个空格区分。
(注:sqllite,字符串拼接为 || 符号,不支持concat函数,mysql支持concat函数)。
输入描述:
无
输出描述:
| Name |
|---|
| Facello Georgi |
| Simmel Bezalel |
| Bamford Parto |
| Koblick Chirstian |
| Maliniak Kyoichi |
| Preusig Anneke |
| Zielinski Tzvetan |
| Kalloufi Saniya |
| Peac Sumant |
| Piveteau Duangkaew |
| Sluis Mary |
题解:
使用concat函数,可以拼接多个字段
1.concat函数:
-
作用: 将多个结果作为字符串拼接在一起
-
语法:
CONCAT(str1,str2...)
2. concat_ws函数
-
作用:将多个结果拼接在一起,使用指定的分隔符
-
语法:
CONCAT_WS(separator,str1,str2,...)
select
concat(last_name, ' ', first_name)
from
employees
版权声明
本文为[不爱研究的研究僧]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_43955488/article/details/124327241
边栏推荐
猜你喜欢

其它-Supervisor的使用

Unity3d C#利用材质(Material)贴图的偏移实现2D游戏单背景图无限移动背景效果功能(含源码)

oracle列转行,拆分一个字段为多列

2、Failed to connect to MySQL Server 8.0.28 after 10 attempts
![[embedded] about IAP + XMODEM receiving bin file from outside to upgrade the chip](/img/05/c69e3701bf80f03c8ec35c033944b1.png)
[embedded] about IAP + XMODEM receiving bin file from outside to upgrade the chip

工作流引擎 参数设置及业务引擎

MySQL数值函数

88% of industrial people don't know that these 7 points of small programs can make the revenue surge, rough and effective! It is strongly recommended to collect and read repeatedly!

PlatoFarm提出永动机模型,将于4月22日在HUOBI开启IEO

低版本R语言ggplot2安装问题解决【rlang>=1.0.0 is require】
随机推荐
通达OA与第三方APP对接
公文管理系统案例展示
强化学习基础篇(一):多臂老虎机 Multi-armed Bandit
Mysql坑爹指南_sql_mode=“ONLY_FULL_GROUP_BY“所导致错误以及不能使用group by
Trie(字典树)
【高并发】不得不说的线程池与ThreadPoolExecutor类浅析
Importance of slip ring technology in machine operation
反射111
Matlab-句柄图形
EeasyBI报表系统 数据源选择代码开发手册
2、Failed to connect to MySQL Server 8.0.28 after 10 attempts
尿素期货几个点涨停?尿素期货怎么做才安全?
[embedded] about IAP + XMODEM receiving bin file from outside to upgrade the chip
Platefarm proposed the perpetual motion machine model and will open the IEO in Huobi on April 22
滑环接线最主要的看什么
Go语言自学系列 | golang类型定义和类型别名
6、Qt使用MySQL例子
[azure application service] after azure function enables managed identity, error appears in PowerShell function: managedidentitycredential authentication failed
【SeMask】Semantically Masked Transformers for Semantic Segmentation
Mysql刷题题解_多表联查_浙江大学的用户在不同难度题目下答题的正确率情况,请取出相应数据,并按照准确率升序输出。