Daniel Grindstaff
Daniel Grindstaff

Reputation: 105

I am trying do utilize the COUNT() function unsuccessfully

I am constructing a view which is supposed to give me the number of students working on any given assignment. Here is what I have so far:

CREATE VIEW v_count AS
    SELECT assignment_no, COUNT(*)
    FROM assignment WHERE          

Upvotes: 0

Views: 36

Answers (2)

Ormoz
Ormoz

Reputation: 3013

change your statement to:

 CREATE VIEW v_count AS
 SELECT assignment_no, COUNT(*) as ct
 FROM assignment
 group by assignment_no

Upvotes: 1

kavetiraviteja
kavetiraviteja

Reputation: 2208

CREATE OR REPLACE VIEW v_count AS
   SELECT assignment_no, COUNT(*) as CountOfStudents
   FROM assignment
     group by assignment_no

try this..

Upvotes: 1

Related Questions