Skip to content
Advertisement

Students who are passed in all subjects and having total marks greater than 170

SQL> select * from marks;

9 rows selected.

Need to calculate who are passed in all subjects(>30 in each subject) and having total mark >170 Here output like :

Advertisement

Answer

You can use grouping with having clause as below

Demo

Edit ( due to your last comment ) : Using

might be a smart way by combining Total Mark and Status. If you really want to sperate those columns, then need to write seperate case when statemants as in the similar manner.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement