Similarly, using the goods table to practice subqueries, the table structure is as follows:All data (cat_id associated with category.cat_id):Category table:Mingoods (test when connecting queries)First, sub-query 1,where sub-query: The result of the
In-depth understanding of four SQL connections-left outer join, right outer join, inner join, and full link bitsCN.com
1. INNER JOIN(Typical join operations use comparison operators such as = or <> ). Including equal join and natural join.The inner
1. Inner join(Typical join operations use comparison operators such as = or <> ). Including equal join and natural join.The inner join uses the comparison operator to match rows in two tables based on the values of the columns in each table. For
1. Inner join(Typical join operations use comparison operators such as = or <> ). Including equal join and natural join.The inner join uses the comparison operator to match rows in two tables based on the values of the columns in each table. For
Objective
Now the various business of the system is so complex, the data are all kinds of tables in the database, the primary key ah, that foreign key ah, and the table and table rely on these primary keys and foreign keys linked together. When we
Mysql join optimization bitsCN.com
Mysql join optimization
1. multi-table connection type
1. Cartesian products (cross join) can be considered as cross join in MySQL, or CROSS is omitted, or ',' such:
SELECT * FROM table1 cross join
Summary of several MySQL join query methods and mysql operation methods
Preface
The various services of the system are so complex that data is stored in various tables in the database. This primary key, that foreign key, the tables and tables depend
In mysql, the left join, right join, and inner join queries are commonly used. But some friends know the differences between them, next I will introduce you to you.
LEFT JOIN
Two tables in the join relationship are displayed. After the data table on
MySQL queries, subqueries, join queries, federated queriesI. MySQL query five seed sentencewhere (conditional query), having (filter), GROUP by (grouping), order by (sort), limit (limits the number of results)Two. Sub-query1.where Sub-querySELECT *
One, union query usage
The union query is simpler, as if the two tables were merged and the fields were combined
If it is
SELECT * FROM table1, table2
Words, two of the same fields will not be merged but
Select A1 from table1 Union Select A1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.