我正构建一个视图,该视图应该为我提供从事任何特定任务的学生人数。以下是我到目前为止的情况:
CREATE VIEW v_count AS
SELECT assignment_no, COUNT(*)
FROM assignment WHERE
答案 0 :(得分:1)
将您的陈述更改为:
CREATE VIEW v_count AS
SELECT assignment_no, COUNT(*) as ct
FROM assignment
group by assignment_no
答案 1 :(得分:1)
CREATE OR REPLACE VIEW v_count AS
SELECT assignment_no, COUNT(*) as CountOfStudents
FROM assignment
group by assignment_no
试试这个..