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

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;
主站蜘蛛池模板: 南郑县| 边坝县| 宁明县| 马关县| 曲靖市| 陈巴尔虎旗| 罗江县| 宝清县| 嘉义县| 绥江县| 全州县| 鹿泉市| 思南县| 绍兴县| 宜城市| 兴宁市| 南丰县| 徐闻县| 清涧县| 雷山县| 山丹县| 伊春市| 开远市| 察雅县| 蒙阴县| 阿合奇县| 屏南县| 天峨县| 六盘水市| 肥西县| 股票| 军事| 凤翔县| 安宁市| 包头市| 昭苏县| 逊克县| 怀宁县| 河东区| 日土县| 安远县|