เป็นคำสั่งที่ใช้สำหรับการระบุเงื่อนไขการเลือกข้อมูลในตาราง (Table) โดยทำการนับข้อความในตำแหน่งที่ต้องการ
Database : MySQL,Microsoft Access,SQL Server,Oracle
Syntax
Database : MySQL,Microsoft Access,SQL Server,Oracle
Syntax
SELECT LENGTH(Name)
As MyLength FROM customer
Table : customer
CustomerID
|
Name
|
Email
|
CountryCode
|
Budget
|
Used
|
C001
|
Win Weerachai
|
win.weerachai@thaicreate.com
|
TH
|
1000000
|
600000
|
C002
|
John Smith
|
john.smith@thaicreate.com
|
EN
|
2000000
|
800000
|
C003
|
Jame Born
|
jame.born@thaicreate.com
|
US
|
3000000
|
600000
|
C004
|
Chalee Angel
|
chalee.angel@thaicreate.com
|
US
|
4000000
|
100000
|
Sample1 การเลือกข้อมูลโดยนับความยาวในฟิวด์ Name
SELECT LENGTH(Name)
AS MyLength FROM customer
Output
MyLength
|
13
|
11
|
9
|
12
|
ที่มา : http://www.thaicreate.com/tutorial/sql-length.html
ไม่มีความคิดเห็น:
แสดงความคิดเห็น