|
The INNER JOIN is one of the join clauses that allow you to query data from two or more related tables.
The INNER JOIN clause combines each row from the first table with every row from the second table, keeping only the rows in which the join condition evaluates to
true.
Returns rows that have matching values in both tables
O INNER JOIN é uma das cláusulas de junção que permite consultar dados de duas ou mais tabelas relacionadas.
A cláusula INNER JOIN combina cada linha da primeira tabela com cada linha da segunda tabela, mantendo apenas as linhas nas quais a condição de junção é avaliada
como verdadeira.
Retorna linhas que possuem valores correspondentes em ambas as tabelas
The following SQL selects all orders with customer information:
O seguinte SQL seleciona todos os OrderID com informações do CustomerName:
SELECT Orders.OrderID
, Customers.CustomerName
FROM Orders
INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID;
|
The following SQL statement selects all orders with customer and shipper information:
A seguinte instrução SQL seleciona todos os OrderID com informações do CustomerName e do ShipperName:
SELECT Orders.OrderID
, Customers.CustomerName
, Shippers.ShipperName
FROM ((Orders
INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID)
INNER JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID); |
Veja também:
|