SQL Function: LEN/LENGTH()
Definition:
Return the length of data.
(Remark:LEN/CHAR_LENGTH() with the same function is provided in HKDSE ICT candidates’ reference sheet.)
Command Example:
Table STUDENT| SID | SNAME | CLASS | CNO |
|---|---|---|---|
| 010122 | Chris Wong | 1A | 5 |
| 010142 | Nico Lin | 1C | 7 |
| 010133 | Amy Chan | 2D | 12 |
Input:
SELECT SID,LEN(SNAME) AS NAME_LEN FROM STUDENT;
Output:
| SID | NAME_LEN |
|---|---|
| 010122 | 10 |
| 010142 | 8 |
| 010133 | 8 |
‘LEN with a lens.’By secondary 6 student
Comments
Post a Comment