Product table:
productId | productName | unitPrice | supplierId
_______________________________________________
1 | Iphone8 | 1500 | 3
2 | Nokia 6 | 800 | 1
3 | Samsung S9 | 1500 | 2
Supplier table:
supplierId | supplierName | country
___________________________________
1 | Nokia Inc | India
2 | Samsung Inc | Korea
3 | Apple Inc | USA
I’m confused, how can I write a query using above two Product
and Supplier
tables to list the product unitprice 1500 only and their supplier Id
, name
and country
. Such as the table below shows.
productId | unitPrice| supplierId |supplierName | country
_____________________________________________
1 | 1500 | 3 | Apple Inc | USA
3 | 1500 | 2 | Samsung Inc | Korea
I used join queries with supplierId
on product
table to get its relating data from the supplier
table. But each time I ended up in error when I try to fetch '= 1500' to this query.
this is the query I tried;
select *
from Product, Supplier
where Product.supplierId = Supplier.supplierId
but it gives all the records, how can I insert "unitPrice = 1500" to this query to achieve my answer?
WHERE unitPrice = 1500
at the end