In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to write the MySQL multi-table connection sql statement, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
In the SQL language, you can specify aliases for tables in two ways
The first is specified by the keyword AS
The second is the alias implementation of adding the table directly after the table name.
You should pay attention to several points when using aliases of tables.
(1) an alias is usually a shortened table name used to reference a specific column in a table in a join. If the same name column exists in multiple tables in the join, the column name must be qualified with the table name or the alias of the table.
(2) if the alias of the table is defined, the table name can no longer be used.
1. Use SELECT clause for multi-table query
SELECT field name FROM Table 1, Table 2... WHERE Table 1. Field = Table 2. Field AND other query criteria
Example:
SELECT a.id,a.name,a.address,a.date,b.math,b.english,b.chinese FROM tb_1 AS b,tb_2 AS a WHERE a.id=b.id
Note: in the above code, the association of two tables is established on the condition that the id field information of the two tables is the same, but it should not be used in actual development, and it is best to use the primary foreign key constraint.
Second, use the alias of the table for multi-table query
Example:
SELECT a.id FROM tb_1 a.namerea.addressrecoveryb.mathreb. Englishreedb.Eng FROM tb_1 arewouldtbplay2b WHERE a.id=b.id AND b.idwritten records written _ post [text]'
MySQL is a relational database management system developed by the Swedish company MySQL AB and currently belongs to the products of Oracle. MySQL is one of the most popular relational database management systems. In terms of WEB applications, MySQL is the best RDBMS (relational database management system) application software.
MySQL is a relational database management system in which relational databases store data in different tables instead of all data in one large warehouse, which increases speed and flexibility.
The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software adopts the dual licensing policy, which is divided into community version and commercial version. Because of its small size, high speed and low total cost of ownership, especially open source, the development of small and medium-sized websites generally choose MySQL as the website database.
The above is all the content of the article "how to write the sql statement of MySQL multi-table join". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.