Hi, I am a newbie at doing sql, I need to write a query that finds the total number of people who has each item.
Below are the tables I have:
Create Table Item (
Item_Name Varchar(20) Primary Key
);
Create Table Person (
Person_Id Integer Primary Key
);
Create Table Item_Set (
Owner_Id references Person(Person_Id),
Item_Owned references Item(Item_Name),
Primary Key (Owner_Id, Item_Name)
);
The output expected would be something like:
Item_Name NO_People_Have
-----------------------------------------------
apple 3
orange 12
Please show me how to write a query like that in sql, help me, thanks!