Cascade kev xaiv nyob rau hauv txawv teb chaws yuam sij?
Cascade kev xaiv nyob rau hauv txawv teb chaws yuam sij?

Video: Cascade kev xaiv nyob rau hauv txawv teb chaws yuam sij?

Video: Cascade kev xaiv nyob rau hauv txawv teb chaws yuam sij?
Video: Cas Tsis Xaiv Koj - R-Lin Thoj New Song Original By Zaj Dub [Official MV] 2023 2024, Kaum ib hlis
Anonim

CASCADE : Rho tawm lossis hloov kho kab los ntawm niam txiv lub rooj, thiab rho tawm lossis hloov kho cov kab sib txuam hauv lub rooj me nyuam. SET NULL: Rho tawm lossis hloov kho kab los ntawm cov lus niam txiv, thiab teeb tsa txawv teb chaws key kab los yog kab hauv lub rooj me nyuam rau NULL.

Hauv qhov no, koj txhais li cas los ntawm kev rho tawm cascade hauv tus yuam sij txawv teb chaws?

A txawv teb chaws key nrog cascade rho tawm txhais tau tias tias yog ib cov ntaub ntawv nyob rau hauv lub rooj niam txiv tshem tawm , ces cov ntaub ntawv sib thooj nyob rau hauv lub rooj me nyuam yuav txiav tau tshem tawm.

Ib yam li ntawd, lub ntsiab lus ntawm Cascade hauv database yog dab tsi? Hauv SQL, cascade rho tawm txhais tau tias yog tias ib qho ntawm cov niam txiv cov ntaub ntawv raug muab tshem tawm, ces tag nrho cov ntaub ntawv tus menyuam sib raug zoo yuav raug muab tshem tawm. Hauv DBMS, kuj tseem muaj kev ua haujlwm hu ua cascading rov qab.

Kuj paub, piv txwv tseem ceeb txawv teb chaws yog dab tsi?

A txawv teb chaws key yog ib kem (los yog kab) uas hais txog ib kem (feem ntau yog thawj tus yuam sij ) ntawm lwm lub rooj. Rau piv txwv , hais tias peb muaj ob lub rooj, ib lub rooj CUSTOMER uas suav nrog tag nrho cov neeg siv khoom cov ntaub ntawv, thiab lub rooj ORDERS uas suav nrog tag nrho cov neeg siv khoom xaj.

Qhov hloov tshiab cascade ua dab tsi?

ON Hloov tshiab CASCADE txhais tau hais tias yog niam txiv thawj tus yuam sij hloov, tus nqi tus me nyuam yuav kuj hloov los xav txog qhov ntawd. ON Hloov tshiab CASCADE ON DELETE CASCADE txhais tau tias yog koj Hloov tshiab LOSSIS DELETE niam txiv, kev hloov yog cascaded rau tus menyuam.

Pom zoo: