现实生活中在哪里使用笛卡尔联接? [英] Where are Cartesian Joins used in real life?

查看:149
本文介绍了现实生活中在哪里使用笛卡尔联接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在现实生活中,笛卡尔联接在哪里使用?

Where are Cartesian Joins used in real life?

可以在任何SQL数据库中给出这样一个Join的例子吗?

Can some one please give examples of such a Join in any SQL database.

推荐答案

只是随机示例.您有一个城市表:Id,Lat,Lon,Name.您要显示用户从一个城市到另一座城市的距离的表.您将编写类似

just random example. you have a table of cities: Id, Lat, Lon, Name. You want to show user table of distances from one city to another. You will write something like

SELECT c1.Name, c2.Name, SQRT( (c1.Lat - c2.Lat) * (c1.Lat - c2.Lat) + (c1.Lon - c2.Lon)*(c1.Lon - c2.Lon))
FROM   City c1, c2

这篇关于现实生活中在哪里使用笛卡尔联接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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