Skip to content

How to find the Group with the Max value

I have a database of students, I have to group them by their class and then find out which class has the most students. I know it’s probably a stupid question but I can’t come to the solution. Sample …

how to rollback tran when error occur in oracle

i try to solve 2 requests below but i only code for the first one,, can any one help to solve the second one Write SQL statements using cursor to update salary of all employees base on update conditionals Make sure all update records have been updated completely. The database transaction will be rolled back i…

Find students who take most courses SQL

Assume there’s a table students containing student id, semester id and number of courses taken in each semester: How can I find students in each semester who took the largest number of courses? Expected output would be: I thought of using OVER PARTITION BY, but I’m not sure how to use it correctly…

Update column using duplicate value counter

I want to calculate the duplicate value counter first, and then use it for another column to be updated. How can I achieve that? first, I have a table below: id another_id 1 null 1 null 1 null 2 …