sql笛卡爾積問題,資料庫問題 笛卡爾積怎麼計算

時間 2022-10-20 18:12:26

1樓:兆青五安珊

就是笛卡爾積,記錄條數就是a的記錄條數*b的記錄條數

2樓:匿名使用者

這個不是笛卡爾積。

如果要滿足你的需求則這樣寫:(假設a,b都只有乙個id欄位)select id from b where id not in (select id from a);

試過沒有?不符合要求嗎?

3樓:莫卡寧

select * from b bb where bb.id not in (select * from a,b where a.id=b.id);

思路:寫個子查詢 把a和b中都有的資料查出來(select * from a,b where a.id=b.id) 然後排除

多看看查詢以及關聯查詢 子查詢的原理 就明白了

4樓:

這不是笛卡爾積吧。

oracle中:select * from b minus select * from a

5樓:匿名使用者

設:表a資料1

23表b資料24

5select 資料 from a where not exists(select 資料 from b)

資料庫問題 笛卡爾積怎麼計算

6樓:匿名使用者

3列和1列一樣!

按照行來計算~~可以把每行的3列看做乙個整體(看成1列)a1 a2 a3 a1 a2 a3

a b c a b c

a b c b a c

a b c c a b

b a c a b c

b a c b a c

b a c c a b

c a b a b c

c a b b a c

c a b c a b

7樓:

rxs,r的第一行分別與s的每一行組成結果集的前三行,依次使r的每一行與s的每一行組合,形成結果集!

sql語言如何把a表的一列與b表建立笛卡爾乘積

8樓:

使用交叉連線產生笛卡爾乘積

select * from a cross join b或不使用任何連線條件,也可產生笛卡爾乘積

select * from a,b

笛卡爾乘積與列無關,如果你想顯示某幾列,就在select後面指定相應的列名即可.

補充:用a表的某列與b表做笛卡爾積,道理是一樣的,你可以把該列看做是乙個表源.如:

select * from

(select distinct 某列 from a) c cross join b

9樓:匿名使用者

select * from (select a.a from a) a, b

2個表的笛卡爾積怎麼用sql語句表示

10樓:丨遙遠的她灬

第乙個表的

行數乘以第二個表的行數等於笛卡爾積結果集的大小

select * from table1 cross join table2

select  a.*,b.*  from table1 a ,table2 b

笛卡爾乘積是指在數學中,兩個   集合   x和   y的笛卡尓積(cartesian product),又稱   直積。

表示為   x ×   y,第乙個物件是   x的成員而第二個物件是   y的所有可能   有序對的其中乙個成員。

假設集合a=,集合b=,則兩個集合的笛卡爾積為。

類似的例子有,如果a表示某學校學生的集合,b表示該學校所有課程的集合,則a與b的笛卡爾積表示所有可能的選課情況。a表示所有聲母的集合,b表示所有韻母的集合,那麼a和b的笛卡爾積就為所

11樓:匿名使用者

select a.*, b.*

from a, b

-- 不加where條件,就是笛卡爾積

12樓:神崎橙

select * from table1 , table2

13樓:匿名使用者

笛卡爾積在sql中的實現方式既是交叉連線(cross join)。所有連線方式都會先生成臨時笛卡爾積表,笛卡爾積是關係代數裡的乙個概念,表示第乙個表的行數乘以第二個表的行數等於笛卡爾積結果集的大小。

參見下面的示例:

declare @temp table (groupid int , groupname varchar(25), itemnumber varchar(25) ) insert into @temp select 1,'5805','27-196-018' union select 1,'5805','27-196-019' union select 2,'5805','27-196-020' union select 2,'5805','27-196-021' union select 3,'5805','27-196-022' union select 3,'5805','27-196-023' select g1_groupid ,g1_itemnumber ,g2_groupid ,g2_itemnumber from ( select groupid as g1_groupid ,itemnumber as g1_itemnumber from @temp where groupid in(1) ) as a cross join ( select groupid as g2_groupid ,itemnumber as g2_itemnumber from @temp where groupid not in(1) ) as b order by a.g1_groupid,a.g1_itemnumber

笛卡爾愛情座標公式的畫法,笛卡爾愛情座標公式的畫法

首先不是畫法,而是公式。笛卡爾二維座標系裡的桃心公式 r a 1 sin 極座標方程 水平方向 a 1 cos 或 a 1 cos a 0 垂直方向 a 1 sin 或 a 1 sin a 0 直角座標方程 心形線的平面直角座標系方程表示式分別為 x 2 y 2 a x a sqrt x 2 y 2...

笛卡爾對上帝證明的存在的證明有什麼價值嗎

為了對付當時經院哲學的信仰主義,並為自己的哲學奠定基礎。當時,經院哲學的上帝是至高無上的統治者,是盲目信仰的物件,是否認人的理性和科學的。而笛卡爾所說的上帝是經過改造的上帝,沒有什麼奇蹟的法力,僅僅在那裡執行給科學當保鏢的任務。所以,有必要證明上帝存在,避免經院哲學家的詰難。但他證明上帝的方式是沿襲...