1. Using character functions in queries
1. Demand
Query the employee's birthday in the employee information table, and
get the birthday according to the employee's ID number.
2. Examples
SQL>select*from users;
ID NAME CARDID DEPTNO REGDATE AGE
-------------------------------------------------------------------------
1 abc 123456199205050105-5月-1718
SQL>select substr(cardid ,7,8)from users;
SUBSTR(CARDID,7,
----------------
19920505
3. Demand
Replace all department number 01 with information technology
4. Examples
SQL>select replace(deptno ,'01','信息技术')from users;
REPLACE(DEPTNO,'01','信息技术')
--------------------------------------------------------------------------------
信息技术
2. Use numeric type functions in queries
1. Demand
Take the remainder of the age field in the employee information table and 10
2. Code
SQL>select mod(age,10)from users;
MOD(AGE,10)
-----------
8
3. Use date functions in queries
1. Demand
The year the employee was hired
Find out the information of employees who joined in May
SQL>select extract(year from regdate)from users;
EXTRACT(YEARFROMREGDATE)
------------------------
2017
SQL>select*from users where extract(month from regdate)=5;
ID NAME CARDID DEPTNO REGDATE AGE
-------------------------------------------------------------------------
1 abc 123456199205050105-5月-1718