Dab tsi yog ib kab subquery operators?
Dab tsi yog ib kab subquery operators?

Video: Dab tsi yog ib kab subquery operators?

Video: Dab tsi yog ib kab subquery operators?
Video: Database SQL DML part3 JOIN 2024, Kaum ib hlis
Anonim

Cov cov neeg ua haujlwm uas tuaj yeem siv nrog ib leeg - kab subqueires yog =, >, >=, <, <=, thiab. Pab pawg ua haujlwm tuaj yeem siv rau hauv subquery . Piv txwv li, nqe lus hauv qab no khaws cov ntsiab lus ntawm tus neeg ua haujlwm tuav cov nyiaj hli siab tshaj plaws. Muaj-clause kuj tuaj yeem siv nrog cov ib leeg - kab subquery.

Hais txog qhov no, tus neeg teb xov tooj twg tsis siv nyob rau hauv ib kab subqueries?

Lwm qhov kev sib piv cov neeg ua haujlwm xws li, >, <, < = tau siv nrog a ib subquery . Cov piv txwv hauv qab no siv '<' tus neeg ua haujlwm nyob rau hauv cov lus nug sab nrauv WHERE clause. AVG() muaj nuj nqi yog siv hauv subquery kom tau txais qhov nruab nrab qhov nyiaj txiav txim, uas tau dhau mus rau qhov chaw nyob ntawm cov lus nug sab nraud.

Qhov thib ob, cov lus nug puas tuaj yeem rov qab ntau kab? Ntau Kab Subqueries Ntau kab subquery rov qab ib los yog ntau tshaj kab mus rau sab nrauv SQL ntawv nqe lus. Koj tuaj yeem siv IN, IB TUG, lossis TAG NRHO tus neeg teb xov tooj hauv cov lus nug sab nrauv los lis a subquery uas rov qab ntau kab . Cov ntsiab lus: Siv TSIS IN tus neeg teb xov tooj nrog a Ntau Kab Subquery.

Raws li, dab tsi yog ib kab subquery?

Ib leeg - kab subqueries yog subqueries siv nrog tus neeg teb xov tooj sib piv hauv qhov twg, lossis HAVING clause. Subqueries uas tuaj yeem rov qab ntau dua ib qho kab (tab sis tsuas yog ib kem) rau cov lus sab nrauv hu ua ntau- kab subqueries . Ntau- kab subqueries yog subqueries siv nrog IN, ANY, lossis ALL clause.

Dab tsi yog ntau kab subquery hauv SQL?

Ntau Kab Sub Query Ntau - kab subqueries yog cov lus nug nested uas tuaj yeem xa rov qab ntau dua ib qho kab ntawm cov txiaj ntsig rau niam txiv query. Ntau - kab subqueries feem ntau yog siv nyob rau hauv qhov twg thiab HAVING clauses. Txij li thaum nws rov qab los ntau kab , nws yuav tsum tau ua los ntawm cov neeg ua haujlwm sib piv (IN, ALL, ANY).

Pom zoo: