如何为Northwinds的所有员工选择雇佣年份,一个简单的查询

问题描述 投票:0回答:1

问。对于 Northwinds 的所有员工,请列出名字和姓氏(中间有空格)以及他们受雇的年份。

`SELECT firstname || ' ' || lastname as "Name"

from employees;`

这可以实现串联,但是为招聘年份添加什么?

我试过这个:-

`SELECT firstname || ' ' || lastname as "Name"
    
 date_part('year', hiredate)
 
from employees;`

这对我不起作用。

postgresql select northwind 2-digit-year
1个回答
0
投票

MySQL

从员工中选择 concat(名字,' ',姓氏) 作为“姓名” 其中年份(日期部分)

© www.soinside.com 2019 - 2024. All rights reserved.