Extracts a substring from a specified position.
Syntax
SUBSTR(str, pos [, len])Example
Enter values below to update the example in real time.
employee_no→team_code→cnt→employees→-- 사원번호 앞 2자리 팀 코드
SELECT SUBSTR(employee_no, 1, 2) AS team_code, COUNT(*) AS cnt
FROM employees
GROUP BY SUBSTR(employee_no, 1, 2);