MySQLString FunctionsSUBSTRING
CONCAT_WS

SUBSTRINGString Functions

LEFT

Extracts a substring from a specified position.

Syntax

SUBSTRING(str, pos, len)

Example

Enter values below to update the example in real time.

email
username
users
-- 이메일에서 '@' 앞 아이디만 추출
SELECT SUBSTRING(email, 1, INSTR(email, '@') - 1) AS username
FROM users;