Write SQL query that would produce these results. Display the number of students
ID: 3914375 • Letter: W
Question
Write SQL query that would produce these results.
Display the number of students from each class that got an A or B in the course.
className grade count(grade)
Database A 3
Database B 2
Computer Based IS A 3
Computer Based IS B 3
Display the className, grade and how many students got an A, B or C in the class. Filter the data to only display the class and grades where there is a count less than 3.
className grade count(grade)
Database B 2
Database C 2
Computer Based IS C 1
Display the last name of all students who have more than 8 characters in their name. The query results should only display unique values (no duplicate results). The results should appear in descending alphabetical order.
lName Lenth
Stephenson 10
O’Connell 9
McRoberts 9
Explanation / Answer
1.
Select className,grade,count(grade) from class group by className,grade having grade = 'A' or grade = 'B';
2.
Select className,grade,count(grade) from class group by className,grade having count(grade) < 3;
3.
Select distinct lName,LEN(lName) from class where LEN(lname) > 8 order by lname desc;
Do ask if any doubt. Please upvote.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.