0

这是问题,请记住我使用的是 SQL developer 3 ....

学生服务部想知道每位教员在向课外学生提供建议时的参与程度。提供教员 ID 列表和教员建议的学生人数。将教师 ID 的输出列命名为“Faculty ID”,将学生计数的输出列命名为“NumStuds”。仅当教员 ID 小于 100 并且学生在姓或名字段中输入了值时才生成输出。按教员 ID 升序显示输出

这就是我得到的...

SELECT F_ID AS "Falculty ID" , COUNT S_ID AS "NumStud" FROM student
WHERE ( s_first, s_last, f_id ) IS NOT NULL
AND IS <= 100
ORDER BY F_ID ACD

然后我在命令的第 329 行开始出现错误错误:

SELECT F_ID AS "Falculty ID" , COUNT S_ID AS "NumStud" FROM student
WHERE ( s_first, s_last, f_id ) IS NOT NULL
AND IS <= 100
ORDER BY F_ID ACD

命令行错误:329 列:42 错误报告:SQL 错误:ORA-00923:在预期的位置找不到 FROM 关键字 00923。00000 -“在预期的位置找不到 FROM 关键字”

请帮忙!

4

2 回答 2

1

尝试:

SELECT F_ID AS "Faculty ID" , COUNT(S_ID) AS "NumStud" 
FROM student
WHERE COALESCE( s_first, s_last ) IS NOT NULL AND F_ID < 100
GROUP BY F_ID 
ORDER BY F_ID ASC
于 2013-03-29T15:04:43.890 回答
1

您不能这样做,因为您正在测试值。应该手动测试。

SELECT F_ID AS "Falculty ID" , COUNT(S_ID) AS "NumStud" 
FROM student 
WHERE   (
            s_first IS NOT NULL OR 
            s_last IS NOT NULL OR
            f_id  IS NOT NULL
        ) AND IS <= 100 
ORDER BY F_ID ASC

二、应该ASC升序ACD

于 2013-03-29T14:17:06.953 回答