Qhov txawv ntawm Cov Lus Txhais thiab Lub Npe

Cov txheej txheem:

Qhov txawv ntawm Cov Lus Txhais thiab Lub Npe
Qhov txawv ntawm Cov Lus Txhais thiab Lub Npe

Video: Qhov txawv ntawm Cov Lus Txhais thiab Lub Npe

Video: Qhov txawv ntawm Cov Lus Txhais thiab Lub Npe
Video: 8 Nqi: Kev txawj ntse koj yuav tau muaj nyob tiam 21 no. 2024, Kaum ib hlis
Anonim

Synonym vs Alias (hauv ORACLE databases) | Private synonyms thiab Public synonyms

In English, synonym and alias muaj ze li ntawm tib lub ntsiab lus. Tab sis hauv databases cov no yog ob yam sib txawv. Tshwj xeeb tshaj yog nyob rau hauv ORACLE databases, ob qho tib si ntawm lawv cov kev siv sib txawv. Synonyms yog siv los xa cov khoom ntawm ib lub schema lossis ib lub database los ntawm lwm lub schema. Yog li synonym yog hom khoom database. Tab sis aliases tuaj nyob rau hauv ib txoj kev sib txawv. Qhov ntawd txhais tau tias; lawv tsis yog cov khoom siv database. Aliases yog siv los xa cov lus, saib thiab kab hauv cov lus nug.

Synonyms

Cov no yog hom khoom siv database. Lawv xa mus rau lwm yam khoom hauv database. Kev siv ntau tshaj plaws ntawm kev sib txuas lus yog, xa mus rau ib qho khoom ntawm ib qho kev sib cais los ntawm kev siv lwm lub npe. Tab sis cov ntsiab lus tuaj yeem tsim los xa cov khoom ntawm lwm cov ntaub ntawv, ib yam nkaus (hauv cov ntaub ntawv faib, siv cov ntaub ntawv txuas). Tables, views, functions, txheej txheem, tej pob khoom, sequences, materialized views, java class objects thiab triggers yuav siv tau raws li cov ntaub ntawv rau cov synonyms. Muaj ob hom lus.

  1. Ntse synonyms (tsuas yog siv tau los ntawm tus neeg siv uas tsim lawv.)
  2. Public synonyms (yuav siv tau los ntawm txhua tus neeg siv uas muaj cai tsim nyog)

Ntawm no, yog ib qho yooj yim syntax los tsim ib lub ntsiab lus nyob rau hauv ib qho database cais, create synonym myschema.mytable1 rau [email tiv thaiv]_link1

Vim tias peb muaj lub npe hu ua mytable1 hauv myschema rau [email tiv thaiv] _link1 (distributed database table), peb tuaj yeem yooj yim xa cov lus faib database siv mytable1. Peb tsis tas yuav siv lub npe khoom ntev nrog cov ntaub ntawv txuas txhua qhov chaw.

Alias

Cov no tsuas yog lwm lub npe rau kev saib, rooj, lossis kab hauv cov lus nug. Lawv tsis yog cov khoom siv database. Yog li, cov npe tsis raug siv tau txhua qhov chaw hauv schema/database. Lawv siv tau hauv cov lus nug nkaus xwb. Cia peb saib qhov piv txwv no, select tab1.col1 as c1, tab2.col2 as c2

from user1.tab1 tab1, user1.tab2 tab2

tab1.col1=tab2.col2

Ntawm no, c1 thiab c2 yog kem npe, uas yog siv rau tab1.col1 thiab tab2.col2, thiab tab1 thiab tab2 yog lub npe npe, uas yog siv rau user1.table1 thiab user2.table2. Tag nrho cov npe no siv tau hauv cov lus nug no nkaus xwb.

Dab tsi yog qhov txawv ntawm Synonym thiab Alias (hauv ORACLE databases)?

Synonyms yog hom khoom siv database. Tab sis aliases tsuas yog ib lub npe xa mus rau ib lub rooj, saib lossis kab hauv cov lus nug. Tsis yog database object

Synonyms tuaj yeem tsim rau cov ntxhuav, saib, ua haujlwm, cov txheej txheem, pob khoom, ntu ntu, cov khoom siv pom, java class object hom thiab triggers. Tab sis cov npe siv tsuas yog siv rau kev pom, rooj thiab lawv cov kab

Pom zoo: