Skip to content
Advertisement

SQL query on two tables using two column as keys

I started studying SQL (not MySQL as it seems to be different in some parts) and I encountered this problem that i could not figure out how to solve

I have the following tables:

I need to find using SQL the suppliers and the number of brown products which they can provide to the store and the store sells them, ordered by the count as ascending (brown products in products table). I started out with sub queries and something like this:

but I cannot figure it out, please help.

The results on these tables need to be:

Advertisement

Answer

At the end I needed the following:

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