for this specific problem I had to enter the query:
SELECT ProductName, Quantity
FROM Products
JOIN OrderDetails
on OrderDetails.Productid= Products.Productid
WHERE Quantity <5
On the website:
https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all
The question that I got this query from from was "Can you modify the SQL so that the results also display the price of each item? Copy all the records shown as results and paste them into your lab document."
The first thing I Tried was reveiwing the way things for spelled and I didnt find any problems. Then I tried to look at the table and chosing a product, getting the Product ID, the Product name the supplier ID, the catagory ID and the quantity of the products orders. That did not work either.
2
Answers
You are missing INNER on the join
SELECT ProductName, Quantity
FROM Products
INNER JOIN OrderDetails
on OrderDetails.Productid= Products.Productid
WHERE Quantity <5
According to the MySQL manual ‘In MySQL, JOIN, CROSS JOIN, and INNER JOIN are syntactic equivalents (they can replace each other)’. However, the SQL editor on this particular website seems to require an explicit
INNER JOIN
(not justJOIN
)