MySQL_Workbench 18

MySQL 날짜와 시간 처리 curdate, curtime, now...

select name, day(birthdate) from people2; -- birthdate 일에대한 정보 select name, dayname(birthdate) form people2 -- 요일 정보 select name, month(birthdate) from people2; -- 달 정보 select name, hour(birthtime) from people2; -- birthtime 시간 정보 select name, minute(birthtime) from people2; -- 분 -- 현재 날짜를 화면에 출력하세요. select curdate(); -- 현재의 요일을 화면에 출력하세요. select dayname( curdate() ); -- 무슨 요일 -- 현재 날짜를 월/일/년도 로..

MySQL_Workbench 2021.12.08

MySQL 문자열에서 일부분 가져오기 substring

substring의 들어가는 숫자는, 1부터 시작 ( 맨 처음 글자가 1 ) select substring(title, 1, 10) from books; -- title 컬럼의 내용 첫번째 글자부터 10번까지만 가져온다. 맨 뒤에서 5번 째 글자부터 끝까지 select substring(title, -5) from books; 5번째 글자부터 15번째 글자까지 가져오는 코드 select substring(title, 5, 15) as title from books; -- 컬럼명을 title로 변경

MySQL_Workbench 2021.12.07