![](https://maz.kr/wp-content/uploads/2022/12/mysql-char-length-thumbnail.png)
CHAR_LENGTH()
CHAR_LENGTH() 함수는 문자열의 길이(문자)를 반환한다.
CHAR_LENGTH() 함수는 CHARACTER_LENGTH()와 동일하다.
MySQL 4.0부터 작동한다.
형식
CHAR_LENGTH(string) CHARACTER_LENGTH(string)
위 형식에서 string에는 길이를 카운트할 문자열을 넣는다.
예제
“CustomerName” 열의 텍스트 길이를 반환한다.
SELECT CHAR_LENGTH(CustomerName) AS LengthOfName FROM Customers;
기본 예시
CustomerName | LengthOfName |
---|---|
Alfreds Futterkiste | 19 |
Ana Trujillo Emparedados y helados | 34 |
Antonio Moreno Taquería | 23 |
Around the Horn | 15 |
Berglunds snabbköp | 18 |
Blauer See Delikatessen | 23 |
Blondel père et fils | 20 |
Bólido Comidas preparadas | 25 |
Bon app’ | 8 |
Bottom-Dollar Marketse | 22 |
B’s Beverages | 13 |
Cactus Comidas para llevar | 26 |
Centro comercial Moctezuma | 26 |
Chop-suey Chinese | 17 |
Comércio Mineiro | 16 |
Consolidated Holdings | 21 |
Drachenblut Delikatessend | 25 |
Du monde entier | 15 |
Eastern Connection | 18 |
Ernst Handel | 12 |
Familia Arquibaldo | 18 |
FISSA Fabrica Inter. Salchichas S.A. | 36 |
Folies gourmandes | 17 |
Folk och fä HB | 14 |
Frankenversand | 14 |
France restauration | 19 |
Franchi S.p.A. | 14 |
Furia Bacalhau e Frutos do Mar | 30 |
Galería del gastrónomo | 22 |
Godos Cocina Típica | 19 |
Gourmet Lanchonetes | 19 |
Great Lakes Food Market | 23 |
GROSELLA-Restaurante | 20 |
Hanari Carnes | 13 |
HILARIÓN-Abastos | 16 |
Hungry Coyote Import Store | 26 |
Hungry Owl All-Night Grocers | 28 |
Island Trading | 14 |
Königlich Essen | 15 |
La corne d’abondance | 20 |
La maison d’Asie | 16 |
Laughing Bacchus Wine Cellars | 29 |
Lazy K Kountry Store | 20 |
Lehmanns Marktstand | 19 |
Let’s Stop N Shop | 17 |
LILA-Supermercado | 17 |
LINO-Delicateses | 16 |
Lonesome Pine Restaurant | 24 |
Magazzini Alimentari Riuniti | 28 |
Maison Dewey | 12 |
Mère Paillarde | 14 |
Morgenstern Gesundkost | 22 |
North/South | 11 |
Océano Atlántico Ltda. | 22 |
Old World Delicatessen | 22 |
Ottilies Käseladen | 18 |
Paris spécialités | 17 |
Pericles Comidas clásicas | 25 |
Piccolo und mehr | 16 |
Princesa Isabel Vinhoss | 23 |
Que Delícia | 11 |
Queen Cozinha | 13 |
QUICK-Stop | 10 |
Rancho grande | 13 |
Rattlesnake Canyon Grocery | 26 |
Reggiani Caseifici | 18 |
Ricardo Adocicados | 18 |
Richter Supermarkt | 18 |
Romero y tomillo | 16 |
Santé Gourmet | 13 |
Save-a-lot Markets | 18 |
Seven Seas Imports | 18 |
Simons bistro | 13 |
Spécialités du monde | 20 |
Split Rail Beer & Ale | 25 |
Suprêmes délices | 16 |
The Big Cheese | 14 |
The Cracker Box | 15 |
Toms Spezialitäten | 18 |
Tortuga Restaurante | 19 |
Tradição Hipermercados | 22 |
Trail’s Head Gourmet Provisioners | 33 |
Vaffeljernet | 12 |
Victuailles en stock | 20 |
Vins et alcools Chevalier | 25 |
Die Wandernde Kuh | 17 |
Wartian Herkku | 14 |
Wellington Importadora | 22 |
White Clover Markets | 20 |
Wilman Kala | 11 |
Wolski | 6 |
참고
W3C School - MySQL CHAR_LENGTH() Function
W3C School - MySQL CHARACTER_LENGTH() Function
W3C School - SQL Tutorial