官术网_书友最值得收藏!

INNER JOIN

Inner joins compare the rows from two tables based on conditions specified in the query. Typically, this type of join would be used to intersect rows that have the same value in a specific column or set of columns. The only rows that would be returned are the ones that have matching rows in both tables, as represented in black in the following diagram:

For example, the AdventureWorks sample database has a Product table that contains the ProductID and Name columns and a ProductInventory table that contains the ProductID and Quantity columns. To write a query that returns the product name and the quantity together, an inner join can be used to combine rows from the Product table with rows from the ProductInventory table based on matching values in the ProductID column. In this case, only products that have rows in both tables will be returned. The query would look like the following:

SELECT Name AS ProductName, Quantity
FROM Production.Product
INNER JOIN Production.ProductInventory ON Product.ProductID = ProductInventory.ProductID;
主站蜘蛛池模板: 米林县| 丽水市| 清河县| 清新县| 平远县| 宜宾县| 蕲春县| 嘉鱼县| 循化| 英德市| 建瓯市| 昌宁县| 永丰县| 行唐县| 揭阳市| 沧源| 衡山县| 西藏| 宁波市| 正蓝旗| 青浦区| 房产| 韶关市| 鹿泉市| 博白县| 双柏县| 陵川县| 大厂| 靖安县| 子洲县| 出国| 鸡东县| 宁乡县| 汨罗市| 怀宁县| 定远县| 武城县| 章丘市| 大悟县| 镇雄县| 鄂州市|