Dab tsi yog kev siv qhov sib txawv hauv MySQL?
Dab tsi yog kev siv qhov sib txawv hauv MySQL?

Video: Dab tsi yog kev siv qhov sib txawv hauv MySQL?

Video: Dab tsi yog kev siv qhov sib txawv hauv MySQL?
Video: Leng Yang - Yog Vim Dab Tsi (Official Full Song | Nkauj Tawm Tshiab) 2020/05/24 2024, Kaum ib hlis
Anonim

MySQL Distinct Clause. MySQL DISTINCT clause yog siv tshem tawm cov ntaub ntawv duplicate los ntawm lub rooj thiab nqa tsuas yog cov ntaub ntawv tshwj xeeb. Cov DISTINCT clause xwb siv nrog rau Xaiv nqe lus.

Ntxiv rau qhov no, qhov sib txawv ua dab tsi hauv MySQL?

Cov MySQL DISTINCT clause yog siv los tshem tawm duplicates los ntawm qhov tshwm sim. Cov DISTINCT clause tsuas yog siv nrog SELECT nqe lus.

Tsis tas li ntawd, kuv tuaj yeem pom qhov tseem ceeb hauv MySQL li cas? Siv DISTINCT kom tau tus nqi tshwj xeeb : Yog peb siv lub DISTINCT clause hauv MySQL nqe lus, 'SELECT DISTINCT Lub Nroog Los Ntawm Cov Kev Pabcuam;', Peb yuav tau txais cov npe ntawm cov nroog, tsis muaj qhov rov ua dua. Nyob rau hauv cov ntaub ntawv saum toj no, MySQL ' xaiv DISTINCT ' nqe lus tshem tawm tag nrho cov duplicate tus nqi los ntawm cov txiaj ntsig.

Tsis tas li ntawd, peb siv cov lus sib txawv li cas nws siv?

Cov Xaiv DISTINCT nqe lus yog siv rov los xwb txawv (sib txawv) tus nqi. Hauv ib lub rooj, ib kem feem ntau muaj ntau qhov sib npaug; thiab qee zaum koj tsuas xav sau npe tus txawv ( txawv ) tus nqi.

Peb puas tuaj yeem siv ntau qhov sib txawv hauv SQL?

SQL ntawv Xaiv DISTINCT Nqe lus DISTINCT tau ua siv nrog Aggregates: COUNT, AVG, MAX, thiab lwm yam. DISTINCT ua haujlwm ntawm ib kem. DISTINCT rau ntau kem tsis txaus siab.

Pom zoo: