在Oracle中,我可以为表中不存在的列定义值,例如
SELECT
C.CUSTOMER_ID, ' ' CUSTOMER_PHONE , 'JAMAICAN' CUSTOMER_NATIONALITY.
我需要知道我是否可以在SQL Server中实现相同的目标。
答案 0 :(得分:3)
是的,非常相似...
SELECT
C.CUSTOMER_ID,
,CUSTOMER_PHONE = ' '
,CUSTOMER_NATIONALITY = 'JAMAICAN'
FROM
YourTable
您还将看到此列的别名为AS
。
SELECT
C.CUSTOMER_ID,
,' ' AS CUSTOMER_PHONE
,'JAMAICAN' AS CUSTOMER_NATIONALITY
FROM
YourTable