+ 1
MULTIPLE TABLES IN SQL
How to write sql query for the following: Distributor (Dno, Dname, Daddress, Dphone) Item (Itemno, Itemname, Colour, Weight), Dist_Item(Dno, Itemno, Qty) a. Find out distributors, who have supplied item number 01. b. Find out details of item supplied by distributor 01.
2 Antworten
+ 3
a.
SELECT Item.Itemno, Distributor.Dname, Distributor.Dno from Dist_Item
JOIN Distributor on Distributor.Dno = Dist_Item.Dno
JOIN Item on Distributor.Itemno = Dist_Item.Itemno WHERE Dist_Item.Itemno = '1';
b.
SELECT Distributor.Dno, Item.Itemno, Item.Itemname, Item.Colour, Item.Weight from Dist_Item
JOIN Distributor on Distributor.Dno = Dist_Item.Dno
JOIN Item on Item.Itemno = Dist_Item.Itemno
WHERE Dist_Item.Dno = '1';
+ 1
https://www.w3schools.com/sql/sql_join.asp
May help you