使用字符操作函数-SQL语言基础

时间:2024-05-15 13:24:53
【文件属性】:

文件名称:使用字符操作函数-SQL语言基础

文件大小:5.26MB

文件格式:PPT

更新时间:2024-05-15 13:24:53

SQL 基础

使用字符操作函数 * SQL> SELECT ename, CONCAT (ename, job), LENGTH(ename), 2 INSTR(ename, 'A') 3 FROM emp 4 WHERE SUBSTR(job,1,5) = 'SALES'; ENAME CONCAT(ENAME,JOB) LENGTH(ENAME) INSTR(ENAME,'A') ---------- ------------------- ------------- ---------------- MARTIN MARTINSALESMAN 6 2 ALLEN ALLENSALESMAN 5 1 TURNER TURNERSALESMAN 6 0 WARD WARDSALESMAN 4 2 * SELECT ename, CONCAT (ename, job), LENGTH(ename), INSTR(ename, 'A') FROM emp WHERE SUBSTR(job,1,5)='SALES'; SELECT ename, CONCAT (ename, job), LENGTH(ename), INSTR(ename, 'a') FROM emp WHERE SUBSTR(job,1,5)='SALES'; Character Manipulation Functions (continued) The slide example displays employee name and job joined together, length of the employee name, and the numeric position of the letter A in the employee name, for all employees who are in sales. Example Modify the SQL statement on the slide to display the data for those employees whose names end with an N. ENAME CONCAT(ENAME,JOB) LENGTH(ENAME) INSTR(ENAME,'A') -------- ------------------- ------------- ---------------- MARTIN MARTINSALESMAN 6 2 ALLEN ALLENSALESMAN 5 1 SQL> SELECT ename, CONCAT(ename, job), LENGTH(ename), 2 INSTR(ename, 'A') 3 FROM emp 4 WHERE SUBSTR(ename, -1, 1) = 'N';


网友评论