Dab tsi yog Boolean cov ntaub ntawv hom hauv SQL Server?
Dab tsi yog Boolean cov ntaub ntawv hom hauv SQL Server?

Video: Dab tsi yog Boolean cov ntaub ntawv hom hauv SQL Server?

Video: Dab tsi yog Boolean cov ntaub ntawv hom hauv SQL Server?
Video: CS50 2013 - Week 8 2024, Kaum ib hlis
Anonim

A boolean yog a hom ntaub ntawv uas tuaj yeem khaws qhov tseeb lossis qhov tsis tseeb. Qhov no feem ntau khaws cia li 1 (tseeb) lossis 0 (tsis tseeb). Nws muaj npe tom qab George Boole uas thawj zaug txhais ib qho kev ua lej ntawm cov logic hauv xyoo pua 19th.

Tsuas yog li ntawd, puas muaj Boolean datatype hauv SQL?

Nyob ntawd yog boolean cov ntaub ntawv hom hauv SQL Server. Nws qhov tseem ceeb tuaj yeem yog TRUE, FALSE lossis UNKNOWN. Txawm li cas los xij, hom ntaub ntawv boolean yog xwb tus tshwm sim a boolean kev nthuav qhia uas muaj qee qhov sib xyaw ua ke ntawm cov neeg ua haujlwm sib piv (piv txwv li =,, =) lossis cov neeg siv cov lus qhia (piv txwv li THIAB, LOSSIS, IN, EXISTS).

Tsis tas li ntawd, Boolean yog dab tsi hauv database? Boolean cov neeg ua haujlwm tsim lub hauv paus ntawm kev ua lej thiab database logic. Lawv txuas koj cov lus tshawb fawb ua ke kom nqaim lossis nthuav koj cov txiaj ntsig. Peb qhov yooj yim boolean Cov neeg ua haujlwm yog: THIAB, LOSSIS, thiab TSIS TAU.

Qhov thib ob, hom ntaub ntawv Boolean siv rau dab tsi?

BOOLEAN tuaj yeem yog siv as a hom ntaub ntawv thaum txhais a kem hauv ib lub rooj los yog ib sib txawv hauv cov txheej txheem database. Kev them nyiaj yug rau lub BOOLEAN cov ntaub ntawv hom pab kev tsiv teb tsaws chaw los ntawm lwm cov khoom siv database. Boolean txhua kab lees txais raws li kev nkag mus rau SQL literals FALSE thiab TRUE.

Boolean tus nqi SQL yog dab tsi?

Loj SQL ntawv 1.0 - Boolean tus nqi . A tus nqi boolean sawv cev qhov tseeb tus nqi . Cov BOOLEAN hom yog 1-byte tus nqi uas qhia tias muaj tseeb, cuav, los yog null. Boolean tuaj yeem muab pov rau lossis los ntawm cov cim cov ntaub ntawv uas muaj "tseeb" lossis "false." Hauv kev sib sau ua ke, "tseeb" xaiv siab dua "tsis tseeb."

Pom zoo: