SQL Server Inner Join and Outer Join

xiaoxiao2021-03-06  82

In a regular database environment, we will often encounter this situation: The information needed is not in the same information table. At this time, you will use Join, of course, Join how to make information from different databases. Combine, you have to see how you use it, a total of four different Join, in which we will introduce Inner Join and Outer Join, and its application inner Join Inner Join should be the most commonly used JOIN mode, It will only pass a record that meets the Join rules, or first takes the syntax Select from

[on ] Now we use MS SQL built-in north wind database is actually practiced! I want to know more about MS SQL built-in database, you can check out the Qa (Query Analyzer), in order to use the North Wind Database, Please perform Use Northwind, then execute the SELECT ProductID, ProductName, Supplierid from Products to remove three fields from the Products product data sheet, which is the product code, product name, supplier, but the results of the query guarantee your boss It is very unsatisfactory, because the supplier code for human beings is really brilliant, this time, Join can be helped. We can check the supplier Select ProductID, ProductName, Suppliers. Supplierid from products inner join suppliers=suproductions.suppliers = Suppliers.supplierid This query result is a card clear! The main spirit of Inner Join is Exclusive, called it to make him character! Just talk about the information that Join rules does not match will be excluded. Fall, such as a product supplier code (Supplier), there is no appearance in the Supplier ID table, then this record will be excluded that the JOIN method of Outer Join is a less us. Even some SQL managers have never used it, this is a sorrowful albeit because of the use of Outer Joi. N is the work of simplifying some queries. Let's take a look at Outer Join syntax Select from o] j ON

转载请注明原文地址:https://www.9cbs.com/read-121781.html

New Post(0)