Home >Database >Mysql Tutorial >Recommended 5 articles about advanced connections

Recommended 5 articles about advanced connections

黄舟
黄舟Original
2017-06-11 09:15:211037browse

Natural Joins Whenever tables are joined, there should be at least one column that appears in more than one table (the joined column). A standard join (the inner join introduced in the previous chapter) returns all data, even if the same column appears multiple times. Natural joins exclude multiple occurrences so that each column is returned only once. How to get this done? The answer is, the system doesn't do the job, you do it yourself. A natural join is a join in which you can select only those unique columns. This is typically done by using wildcards ( SELECT * ) for one table and explicit subsets for all other tables' columns. Here is an example: input: select c.*,o.order_num,o.order_date,oi.prod_id,oi.quantity,oi.item_price from customers as c, orders as o, orderitems as oi where 

1. mysql advanced join-natural join, external join usage examples

Recommended 5 articles about advanced connections

Introduction :Natural Join Whenever tables are joined, there should be at least one column that appears in more than one table (the joined column). A standard join (the inner join introduced in the previous chapter) returns all data, even if the same column appears multiple times. Natural joins exclude multiple occurrences so that each column is returned only once.

2. mysql advanced connection-self-join usage example

Recommended 5 articles about advanced connections

Introduction: Self-Join As mentioned earlier, one of the main reasons for using table aliases is to reference the same table more than once in a single SELECT statement. Here's an example. Suppose you find an issue with an item (whose ID is DTNTR ) and want to know if other items produced by the supplier that produces this item also have these issues. This query requires first finding the supplier that produces the item with ID DTNTR, and then finding other items produced by this supplier.

3. mysql advanced join-using table aliases and using join conditions

Recommended 5 articles about advanced connections

Introduction: Using table aliases In addition to aliases for column names and calculated fields, SQL also allows aliases for table names. There are two main reasons for doing this: 1. To shorten the SQL statement; 2. To allow the same table to be used multiple times in a single SELECT statement.

4. SQL must-know notes 11 Creating advanced joins

Introduction: 1. Use table alias SQL In addition to aliasing column names and calculated fields, aliases are also allowed for table names. There are two main reasons for doing this: to shorten SQL statements; and to allow the same table to be used multiple times in a SELECT statement. Example of using table alias: 1 SELECT cust_name, cust_contact 2 FROM Customers AS C, Orders AS O, O

5. MySQLCreate Advanced Join_MySQL

Recommended 5 articles about advanced connections

Introduction: SQL allows aliases for tables. The two main reasons for doing so are: to shorten the SQL statement; to allow aliases in a single SELECT The same table is used multiple times in the statement; corresponding to the previous one, we use aliases to represent a table: Self-joining problem: Suppose you know that a product produced by a certain manufacturer has an ID of

【 Related Q&A recommendations]:

The above is the detailed content of Recommended 5 articles about advanced connections. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn