substirng()2 함수 예제 1 세팅 데이터베이스test6테이블books컬럼id - int, pri, not null, auto incrementtitle - varchar(100)author_fname - varchar(100)author_lname - varchar(100) released_year - intstock_quantity -intpages - int 더보기INSERT INTO books (title, author_fname, author_lname, released_year, stock_quantity, pages)VALUES('The Namesake', 'Jhumpa', 'Lahiri', 2003, 32, 291),('Norse Mythology', 'Neil', 'Gaiman',2016, 43, 304),('Amer.. 2024. 11. 28. MySQL Substirng() 함수 -- 문자열 데이터의 일부분만 가져오는 함수 substring() = subrtr()-- 책 제목을 10글자만 보여주려고 합니다. 제목 컬럼은 short_title로 해주세요 SELECT title, SUBSTRING(title,1,10) as short_titleFROM books b ;Title 데이터의 첫 글자부터 10개까지 가져옵니다. SELECT title, left(title,10)from books b ;left도 같은 기능을 합니다. title 데이터의 10번째 문자열부터 끝까지의 문자열을 가져옵니다. SELECT title, substr(title,10)from books b ;-- 책 제목을 맨 뒤 7번째 글자부터 끝까지 가져오세요.SELECT SUBSTR(title,-7)FROM b.. 2024. 11. 27. 이전 1 다음