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

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;
主站蜘蛛池模板: 内黄县| 新津县| 水城县| 哈巴河县| 体育| 延川县| 南丹县| 洞口县| 龙游县| 科技| 韶山市| 赤峰市| 太和县| 苗栗县| 舟山市| 克什克腾旗| 长子县| 高邮市| 嘉兴市| 新乡县| 惠安县| 宝应县| 额济纳旗| 巴里| 揭东县| 武冈市| 老河口市| 汤原县| 房山区| 大悟县| 海伦市| 当雄县| 伊川县| 密山市| 桑植县| 永定县| 南安市| 怀宁县| 阿城市| 南宫市| 富平县|