Cartesian khoom koom nrog yog dab tsi?
Cartesian khoom koom nrog yog dab tsi?

Video: Cartesian khoom koom nrog yog dab tsi?

Video: Cartesian khoom koom nrog yog dab tsi?
Video: Leng Yang - Yog Vim Dab Tsi (Official Full Song | Nkauj Tawm Tshiab) 2020/05/24 2024, Kaum ib hlis
Anonim

A Cartesian koom los yog Cartesian khoom yog a 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 lub rooj A nrog 100 kab yog koom nrog rooj B nrog 1000 kab, a Cartesian koom yuav rov 100,000 kab.

Ib yam li ntawd, koj tuaj yeem nug, qhov txawv ntawm Cartesian cov khoom thiab koom nrog yog dab tsi?

SQL INTER Koom : Nws xa rov qab cov ntaub ntawv (los yog kab) nyob rau hauv ob lub rooj Yog tias muaj tsawg kawg yog ib qho kev sib tw nruab nrab kab. SQL ntawv CROSS JOIN : Nws rov qab Cartesian khoom ntawm ob lub rooj. Cartesian khoom txhais tau tias Number of Rows tam sim no hauv Table 1 Multiplied by Number of Rows tam sim no hauv Table 2.

Qhov thib ob, Cartesian yog dab tsi hauv database? A Cartesian koom, tseem hu ua a Cartesian khoom, yog kev koom ua ke ntawm txhua kab ntawm ib lub rooj rau txhua kab ntawm lwm lub rooj. Piv txwv li, yog lub rooj A muaj 100 kab thiab koom nrog rooj B, uas muaj 1,000 kab, a Cartesian koom yuav ua rau 100,000 kab.

Ib yam li ntawd, kev siv Cartesian koom nrog yog dab tsi?

A hla koom yog siv thaum koj xav tsim ua ke ntawm txhua kab los ntawm ob lub rooj. Tag nrho cov kab sib txuas yog suav nrog hauv qhov tshwm sim; qhov no feem ntau hu ua cross khoom koom . Ib qho siv rau a hla koom yog tsim kom tau txais tag nrho cov khoom sib xyaw ua ke, xws li xim thiab qhov ntau thiab tsawg.

Puas yog sab hauv koom nrog Cartesian cov khoom?

Cov CARTESIAN JOIN los yog CROSS Koom xa cov Cartesian khoom ntawm cov ntaub ntawv teev tseg los ntawm ob lossis ntau lub rooj sib koom. Yog li, nws sib npaug rau ib qho sab hauv koom qhov twg koom -condition ib txwm ntsuas rau qhov tseeb lossis qhov twg koom - mob yog tsis tuaj ntawm cov lus.

Pom zoo: