可视化联接的方法 [英] Methods of visualizing joins

查看:105
本文介绍了可视化联接的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道是否有人使用任何技巧(或工具)来可视化联接.您知道,您编写了完美的查询,单击运行,并且在运行20分钟后,您意识到自己可能已经创建了笛卡尔联接.

Just wondering if anyone has any tricks (or tools) they use to visualize joins. You know, you write the perfect query, hit run, and after it's been running for 20 minutes, you realize you've probably created a cartesian join.

有时候我很难想象当我添加另一个join语句时会发生什么,并且想知道人们在尝试将许多联接组合在一起时是否使用了不同的技术.

I sometimes have difficulty visualizing what's going to happen when I add another join statement and wondered if folks have different techniques they use when trying to put together lots of joins.

推荐答案

始终牢记目的.

  1. 确定您需要哪些列

  1. Ascertain which are the columns you need

尝试找出执行此操作所需的最小表数.

Try to figure out the minimum number of tables which will be needed to do it.

用表格写您的FROM零件,该表格将提供最大列数.例如来自Team T

Write your FROM part with the table which will give max number of columns. eg FROM Teams T

在新行上逐个添加每个联接.确保每一步都需要外,内,左,右联接.

Add each join one by one on a new line. Ensure whether you'll need OUTER, INNER, LEFT, RIGHT JOIN at each step.

通常为我工作.请记住,它是结构化查询语言.始终将查询分成逻辑行,这会容易得多.

Usually works for me. Keep in mind that it is Structured query language. Always break your query into logical lines and it's much easier.

这篇关于可视化联接的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆