-- concat 함수 > 문자열 합치는 함수
select concat(author_fname, ' ', author_lname)
from books;
-- author_fname과 author_lname의 문자를 합쳐서 보여준다.
select concat(title, ' : ', author_fname, ' ', author_lname)
from books;
-- 여러개도 가능합칠때 자동으로 공백이 들어가게 해주는 함수
꼭 공백을 넣는다기 보다는 합치는 문자열의 중간에 특정 문자를 넣는것을 뜻힌다.
-- 첫번째 파라미터에 넣은 값이 변수끼리의 중간에 들어갈 값이 정하는 것이다.
select concat_ws(' ', author_fname, author_lname)
from books;
-- 쉼표 문자 또한 가능하다.
select concat_ws(',', author_fname, author_lname)
from books;
문자열 데이터의 일부분만 가져오는 함수
음수를 넣을 시 뒷부분 부터 읽는 다는 뜻이다.
-- 책 제목을 10글자만 보여주려한다.
select substring(title, 1, 10) as short_title
from books;
-- 제목을 맨 뒤에서 7번째 글자부터 끝까지 가져오시오
select substr(title, -7)
from books;
-- 문자열 변경 replace()
select replace(title, 'The', '')
from books;-- 문자열의 순서를 역순으로 바꿔주는 함수
select reverse( title )
from books;select char_length(title)
from books;select upper(title), lower(title)
-- 대문자 변경, 소문자 변경
from books;