我需要这个来创建一个新列,当它用数据填充它时,如果男性添加“是”'如果女性插入没有'
SELECT * FROM ADD_FACULTY_OVERRIDE
WHEN "GENDER" ='Male' INSERT 'YES' AS "Financial Aid"
答案 0 :(得分:2)
首先,尽量避免使用SELECT *
,在运行查询时代价很高,根据经验明确列出您的列。这就是你想要的:
SELECT EAGLE_ID
,DEPT_ID
,LAST_NAME
,FIRST_NAME
,MIDDLE_NAME
,GENDER
,BIRTHDATE
,ETHNICITY
,TENURE
,SHORT_TITLE
,FULL_TIME
,EMAIL
,CASE
WHEN GENDER = 'Male'
THEN 'Yes'
WHEN GENDER = 'Female'
THEN 'No'
ELSE ''
END AS [Financial_Aid]
FROM ADD_FACULTY_OVERRIDE