MySQL 中引用和连接的持久性如何?
“加入”有什么作用?我在 phpMyAdmin 中找不到任何“辅助键”...,只有主键。尽管我经常在书中读到它们,但它们似乎是实例化的或环境性的,而不是永久的。换句话说,“连接”仅存在于选择中,还是当存在 JOIN
或 REFERENCE
时数据库结构本身会发生变化?
What does 'joining' do? I can't find any 'secondary key' in phpMyAdmin..., only primary keys. Even though I often read about them in my books, they seem like to be instantiated or environmental, rather than permanent. In other words, do 'joins' only exist in selects, or does the database structure itself change when there is a JOIN
or a REFERENCE
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
JOIN 是一种抽象方法(即,数据库中物理上不存在任何东西),仅在相关查询期间发生(无双关语)。 JOIN 用于跨多个相互引用的表的查询。 * JOIN 的工作不需要引用。 JOIN 所做的只是连接目标表,为您提供更广泛的数据集以从中选择值。
常见的连接类型有 INNER JOIN、OUTER JOIN、LEFT JOIN、RIGHT JOIN 和 CROSS JOIN。 你之前的问题是一个交叉连接,尽管关键字本身被省略了。即:
SELECT A.name, B.name FROM table1 A, table2 B
——隐式交叉联接。SELECT A.country, B.country FROM iteration1 A CROSS JOIN iteration2 B
是显式的。这只是一个品味问题。通常,联接会创建大型数据集,并且您需要对查询进行引出(使用 WHERE 或类似方法)以提取您要查找的数据。
A JOIN is an abstract method (i.e., it's nothing that physically exists in the database) that occurs only during the query in question (no pun intended). JOIN is used in queries that span several tables that have references to each other. *It is not necessary to have references for a JOIN to work. What JOIN does is simply joins targeted tables, giving you a broader data set to select values from.
Common types of joins are INNER JOIN, OUTER JOIN, LEFT JOIN, RIGHT JOIN and CROSS JOIN. The one used in your previous question was a CROSS JOIN, although the keyword itself was left out. That is:
SELECT A.name, B.name FROM table1 A, table2 B
--an implicit cross join.SELECT A.country, B.country FROM iteration1 A CROSS JOIN iteration2 B
is explicit. It's just a matter of taste.Generally, joins create large data sets, and you need to pinout your queries (using WHERE or similar) to extract the data you are looking for.
连接仅与特定查询相关,并且仅在其执行时持续存在。
The joining is only related to a particular query and only persists for its execution.