Sab nrauv siv ua dab tsi?
Sab nrauv siv ua dab tsi?

Video: Sab nrauv siv ua dab tsi?

Video: Sab nrauv siv ua dab tsi?
Video: tos koj hauv nruab dab - nuj xeem - nkauj tawm tshiab fullMV 2021 2024, Kaum ib hlis
Anonim

TSEV KAWM NTAWV rov qab ob kab uas tsim ib qho kev tshwm sim, thiab kab uas ua tsis yog, nrog NULL qhov tseem ceeb hauv cov kab uas tsim los ntawm cov lus muaj nuj nqis. TSEV KAWM NTAWV ua haujlwm li LEFT OUTER Koom.

Khaws qhov no hauv kev txiav txim siab, thaum twg siv Cross Apply thiab Outer Apply?

CROSS APPLY tuaj yeem siv los hloov nrog PIB HAIV NEEG thaum peb xav tau cov txiaj ntsig los ntawm Master lub rooj thiab muaj nuj nqi. THOV tuaj yeem siv los hloov UNPIVOT. Los yog CROSS APPLY los yog TSEV KAWM NTAWV siv tau ntawm no, uas yog interchangeable. Xav tias koj muaj cov lus hauv qab no (lub npe MYTABLE).

Dab tsi yog cross thov thiab sab nraud siv hauv SQL Server? SQL Server THOV tus neeg teb xov tooj muaj ob qhov sib txawv; CROSS APPLY thiab OUTER APPLY . Cov CROSS APPLY tus neeg teb xov tooj rov qab tsuas yog cov kab los ntawm cov lus qhia sab laug (hauv nws qhov kev tso tawm zaum kawg) yog tias nws phim nrog cov lus qhia txoj cai. Hauv lwm lo lus, cov lus qhia txoj cai rov qab kab rau cov lus qhia sab laug nkaus xwb.

Kuj kom paub, vim li cas siv sab nrauv siv hauv SQL?

Koom nrog cov rooj thiab cov rooj muaj nuj nqis uas siv TSEV KAWM NTAWV . Txhawm rau khaws tag nrho cov kab los ntawm ob lub rooj ntawm lub cev thiab cov zis ntawm lub rooj muaj nuj nqis, TSEV KAWM NTAWV yog siv . TSEV KAWM NTAWV yog semantically zoo ib yam li cov OUTER JOIN kev ua haujlwm.

Qhov sib txawv ntawm sab laug koom thiab sab laug sab nraud yog dab tsi?

Hauv SQL, lub sab laug koom rov qab tag nrho cov ntaub ntawv los ntawm thawj lub rooj thiab cov ntaub ntawv sib phim los ntawm lub rooj thib ob. Yog tias tsis muaj qhov sib tw los ntawm lub rooj thib ob ces tsuas yog cov ntaub ntawv los ntawm thawj lub rooj rov qab. Yeej tsis muaj txawv hauv sab laug koom thiab sab laug sab koom . Sab laug sab koom kuj rov zoo li qub sab laug koom.

Pom zoo: