Skip to content
Advertisement

How to unite two SQL statements when referencing a few tables

I have the following TABLES and RECORDS.

I need to answer the following query: Find the names of all the teachers that Ann Chin has, along with all her classes and midterm grades from each.

So far, I have tried many SELECT combinations, but I keep getting duplicate values and returns.

This is the closest I have come:

I basically need to do what these two statements do separately together. Can you please tell me how?

Advertisement

Answer

You should use INNER JOINs here:

This produces:

db<>fiddle here

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