Ass 4
Ass 4
Section : CA
Roll No. : 24
Assignment : 04
19. Give state and number of colleges of a state that has more
than 1 college.
Ans: select state, count(cname) from college group by state
having count(cname) > 1;
25. Find how many students have the same GPA among all
students. (provide this frequency in two-column table as GPA
3.9 is 4 times, GPA 2.9 is 2 times )
Ans: select gpa, count(sid) as no_of_samegpa from student
group by gpa;
26. Find how many application of each major are rejected and
accepted.
Ans: select major, decision, count(*) from apply group by
decision, major;
27. Find out the acceptance rate for each college. (Acceptance
Rate is the percentage of the number application accepted w. r.
t. the number of application received)
Ans: select cname, count(case when decision='Y' then 1 END) /
count(decision) * 100 as acceptance_rate from apply group by
cname;