A Database Attribute txhais cov khoom ntawm lub rooj

Cov txheej txheem:

A Database Attribute txhais cov khoom ntawm lub rooj
A Database Attribute txhais cov khoom ntawm lub rooj
Anonim

A database muaj cov ntxhuav, txhua tus uas muaj kab thiab kab. Txhua kab (hu ua tuple) yog cov ntaub ntawv teeb tsa uas siv rau ib yam khoom, thiab txhua kab muaj cov yam ntxwv uas piav qhia txog kab. Hauv database lingo, cov kab no hu ua tus cwj pwm. Tus cwj pwm database yog ib kab npe thiab cov ntsiab lus ntawm cov teb hauv qab nws hauv lub rooj.

Tus cwj pwm piav qhia cov koom haum

Yog tias koj muag cov khoom thiab nkag mus rau hauv ib lub rooj nrog kab rau ProductName, Nqe, thiab ProductID, txhua qhov ntawm cov npe yog tus cwj pwm. Nyob rau hauv txhua daim teb nyob rau hauv cov nqe lus, koj yuav tsum sau cov khoom npe, nqi, thiab cov khoom IDs, raws li. Txhua qhov kev nkag teb chaws kuj yog tus cwj pwm. Qhov no ua rau muaj kev nkag siab zoo, vim tias qhov kev txhais tsis zoo ntawm tus cwj pwm yog tias nws piav qhia tus yam ntxwv lossis qhov zoo ntawm qee yam.

Ntawm no yog ib qho piv txwv ntawm feem ntau-cited Northwinds database. Cov ntaub ntawv no suav nrog cov ntxhuav (tseem hu ua cov koom haum los ntawm cov neeg tsim qauv database) rau Cov Neeg Siv Khoom, Cov Neeg Ua Haujlwm, thiab Cov Khoom, thiab lwm yam. Cov Khoom Table txhais cov yam ntxwv ntawm txhua yam khoom. Cov no suav nrog tus ID khoom, npe, tus neeg muag khoom ID (siv raws li tus yuam sij txawv teb chaws), kom muaj nuj nqis, thiab tus nqi. Txhua yam ntawm cov yam ntxwv no yog tus cwj pwm ntawm lub rooj (lossis qhov chaw) npe khoom.

Tus cwj pwm yog ib qho ntawm cov ntaub ntawv hauv cov tuple uas nws koom. Txhua tuple yog cov ntaub ntawv uas siv rau ib yam khoom. Cov npe kab npe yog cov yam ntxwv ntawm ib yam khoom, thiab kev nkag hauv kab kuj yog tus cwj pwm ntawm ib yam khoom.

Npaj ua qauv databases, zoo li MySQL Sample Database los ntawm MySQL, muaj rau rub tawm dawb hauv lub vev xaib. Ua hauj lwm nrog ib qho ntawm cov no yog ib txoj hauv kev zoo kom kawm paub tias databases ua haujlwm li cas.

Image
Image

Yog tus cwj pwm ua teb?

Qee zaum, cov ntsiab lus "thaj chaw" thiab "tus cwj pwm" yog siv sib hloov, thiab rau ntau lub hom phiaj, lawv yog tib yam. Txawm li cas los xij, daim teb piav qhia txog ib lub xov tooj ntawm tes hauv ib lub rooj pom ntawm txhua kab, thiab tus cwj pwm piav qhia txog tus yam ntxwv ntawm lub cev hauv kev tsim qauv.

Nyob hauv cov lus saum toj no, Cov Khoom Npe nyob rau kab thib ob yog Chang. Nov yog thaj teb. Thaum tham txog cov khoom feem ntau, ProductName yog cov khoom lag luam kab. Nov yog tus cwj pwm.

Txhais yam ntxwv

Tus cwj pwm yog txhais raws li lawv lub npe. Ib lub npe txhais cov txiaj ntsig tau tso cai uas tus cwj pwm tuaj yeem muaj. Qhov no suav nrog nws hom ntaub ntawv, qhov ntev, qhov tseem ceeb, thiab lwm yam ntsiab lus.

Piv txwv li, tus sau rau tus cwj pwm ProductID tuaj yeem qhia tus lej cov ntaub ntawv. Tus cwj pwm tuaj yeem txhais tau ntxiv kom xav tau qhov ntev tshwj xeeb lossis qhia seb tus nqi khoob lossis tsis paub raug tso cai.

Xav paub ntau ntxiv txog qhov tseem ceeb ntawm cov ntaub ntawv? Peb Cov Ntaub Ntawv Cov Ntaub Ntawv rau Beginners phau ntawv qhia yog qhov chaw zoo pib.

Pom zoo: