Puas yog MySQL muaj varchar2?
Puas yog MySQL muaj varchar2?

Video: Puas yog MySQL muaj varchar2?

Video: Puas yog MySQL muaj varchar2?
Video: Mang Vang New Song 2020 - puas yog vim kuv [Official Video] 2024, Hlis ntuj nqeg
Anonim

Ua ntej ntawm tag nrho cov varchar yog siv nyob rau hauv MySQL thiab varchar 2 yog siv hauv Oracle. MySQL txhawb hom CHAR thiab VARCHAR rau hom cim nrog qhov ntev uas tsawg dua 65, 535 bytes. Hom CHAR tuaj yeem muaj qhov ntev tshaj plaws ntawm 255 bytes, thiab raws li ntawm MySQL 3.23 kuj tseem tuaj yeem tshaj tawm nrog qhov ntev ntawm 0 byte.

Tib neeg kuj nug, qhov txawv ntawm varchar thiab varchar2 hauv MySQL yog dab tsi?

Tam sim no VARCHAR coj raws nraim tib yam li VARCHAR 2 . Txawm li cas los xij, hom VARCHAR yuav tsum tsis txhob siv raws li nws yog tseg rau yav tom ntej siv. Qhov loj txawv yog tias VARCHAR 2 yog ib hom ntaub ntawv sab hauv thiab VARCHAR yog hom ntaub ntawv sab nraud.

Ib yam li ntawd, varchar2 data type yog dab tsi? Cov VARCHAR2 datatype yog siv los tuav tus cwj pwm cov ntaub ntawv , suav nrog cov lej. Yog tias koj khaws ib lo lus tsib tsab ntawv hauv qhov ntawd kem , cov VARCHAR2 datatype tsis xav kom tag nrho 30 bytes muab faib. Es tsis txhob, nws tsuas yog xav tau qhov chaw khaws cov lus tsib tsab ntawv, lossis tsib bytes hauv ib qho-byte cim teeb.

Ntawm no, varchar2 tuaj yeem khaws cov lej?

Rau khw Hloov pauv-ntev cov cim kab, koj siv Oracle VARCHAR 2 hom ntaub ntawv. A VARCHAR 2 kem tuaj yeem khaws cia tus nqi uas nyob ntawm 1 txog 4000 bytes. Nws txhais tau hais tias rau ib tug ib-byte cim teeb, koj tuaj yeem khaws cia mus txog 4000 cim hauv a VARCHAR 2 kem.

Dab tsi yog qhov siab tshaj plaws ntawm varchar2 hom sib txawv?

Hloov pauv - ntev cim hlua muaj qhov siab tshaj qhov ntev bytes los yog cim. Qhov loj tshaj plaws yog 4000 bytes lossis cim, thiab yam tsawg kawg yog 1 byte lossis 1 tus cim. Koj yuav tsum qhia qhov loj rau VARCHAR 2.

Pom zoo: