Yuav ua li cas peb thiaj zam Cartesian koom?
Yuav ua li cas peb thiaj zam Cartesian koom?

Video: Yuav ua li cas peb thiaj zam Cartesian koom?

Video: Yuav ua li cas peb thiaj zam Cartesian koom?
Video: tsuas hlub koj xwb sua vaj & tubzeb vwj new song 2018 - YouTube 2024, Kaum ib hlis
Anonim

Rau zam Cartesian cov khoom, txhua qhov kev pom hauv cov lus los ntawm cov lus yuav tsum tau txuas nrog txhua qhov kev pom los ntawm ib leeg koom predicate, los yog ib tug saw ntawm koom kwv yees. Nov yog qee qhov xwm txheej thaum Cartesian cov khoom nruab nrab ntawm ob qhov kev pom tsis qhia txog kev ua haujlwm tsis zoo.

Kuj nug, dab tsi ua rau Cartesian khoom?

Hauv ib CARTESIAN JOIN muaj kev koom ua ke rau txhua kab ntawm ib lub rooj rau txhua kab ntawm lwm lub rooj. Thaum tsis muaj qhov xwm txheej qhov twg CARTESIAN JOIN yuav coj zoo li ib CARTESIAN KHOOM . i.e., tus naj npawb ntawm kab hauv qhov tshwm sim-set yog qhov khoom ntawm tus naj npawb ntawm kab ntawm ob lub rooj.

Cartesian yuam kev yog dab tsi? Cov Cartesian lub voj voog yog lub peev xwm yuam kev nyob rau hauv kev xam pom los ntawm René Descartes. Cov Cartesian lub voj voog yog ib qho kev thuam ntawm cov saum toj no uas siv daim ntawv no: Descartes 'cov pov thawj ntawm kev ntseeg tau ntawm kev pom tseeb thiab txawv txav yuav siv sij hawm los ua qhov tseem ceeb ntawm Vajtswv lub neej raws li ib tug neeg tsis dag.

Tom qab ntawd, ib tus tuaj yeem nug, Cartesian koom nrog SQL yog dab tsi?

A Cartesian koom los yog Cartesian khoom yog ib koom ntawm txhua kab ntawm ib lub rooj rau txhua kab ntawm lwm lub rooj. Qhov no feem ntau tshwm sim thaum tsis muaj qhov sib txuam koom kab lus tau teev tseg. Piv txwv li, yog tias rooj A nrog 100 kab yog koom nrog rooj B nrog 1000 kab, a Cartesian koom yuav rov 100,000 kab.

Koj ua li cas Cartesian cov khoom?

Cartesian khoom : Cov Cartesian khoom ntawm ob pawg A thiab B, txhais tau tias A × B, yog cov txheej txheem ntawm txhua qhov kev txiav txim ua khub uas cov ntsiab lus ntawm A yog thawj zaug thiab cov ntsiab lus ntawm B yog thib ob. Nyob rau hauv set-builder notation, A × B = {(a, b): a ∈ A thiab b ∈ B}. Piv txwv li: Cia A = {H, T} thiab B = {1, 2, 3, 4, 5, 6}.

Pom zoo: