I think that example will help you to understand better. Some examples:
Code:
AS SELECT * FROM orders or customers AS c WHERE AND orderId c.idClient o.idClient => 1000;
SELECT * FROM customers JOIN orders AS or AS c WHERE orderId c.idClient on o.idClient => 1000;
These two queries are equivalent, representing an inner join: extract data on orders and customer orders for those who have an ID greater than 1000. The first is an implicit join: in fact we have not explicitly stated, and we put the join condition in the WHERE clause. When more than one table in the FROM list without declaring explicitly JOIN are doing an inner join (or a cross join unless specified join conditions in WHERE). In the second, instead of 'JOIN' we could write out 'INNER JOIN'; in some older versions of MySQL that is required.
Code:
SELECT * FROM orders as customers or as c LEFT JOIN ON WHERE orderId c.idClient o.idClient => 1000;
In this case, we performed a left outer join: The query gets the same results as the previous two, but most will return any rows in the Orders table where the CustomerID value does not correspond to the Customers table. In these rows in the result table, the fields will be valued in the other table to NULL. So we could run a query that extracts only the first rows of the table without a corresponding way:
Code:
SELECT * FROM orders as customers or as c LEFT JOIN ON o.idClient = c.idClient
WHERE orderId> 1000 IS NULL AND c.idClient
Bookmarks