SQL Function: MID()
Definition:
Return a substring of the provided string with given start index and number of character.
(Remark:MID/SUBSTRING/SUBSTR() with the same function is provided in HKDSE ICT candidates’ reference sheet.)
Command Syntax:
MID(string, start_index, number_of_character)
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 MID(SNAME, 2, 4) AS Result FROM STUDENT;
Output:
| Result |
|---|
| ris |
| co L |
| y Ch |
‘0 is extremly important in ICT.’By secondary 6 student
Comments
Post a Comment