본문 바로가기

전체 글57

[MariaDB] 9. 수학 함수 abs(숫자) 절대값 ceiling(숫자) 올림 floor(숫자) 내림 round(숫자) 소숫점 올림 round(숫자, 소숫점 자리 수) 소수점 자리 수까지 올림 truncate(숫자, 소숫점 자리 수) 소수점 자리 수까지 자름 pow(숫자, 승) mod(숫자,숫자) 나머지 구하기 pi() pi greatest(숫자,숫자, ... ) 가장 큰 숫자 return least(숫자,숫자, ... ) 가장 작은 숫자 return interval(첫 숫자,숫자, ... ) 첫 숫자가 뒤에 나오는 숫자들과 값 비교하여 위치를 return 처음으로 비교하는 숫자가 더 크면 return = 0 2022. 12. 20.
[MariaDB] 8. 문자열 및 날짜 자르기 공백 포함해서 index를 센다. left (문자열, count) 1~count right (문자열, count) (end_index - count) ~ end_index mid (문자열, index) index~end_index mid (문자열, index, count) index ~ count substring(문자열, index) index~end_index substring (문자열, index, count) index ~ count 길이 length length(문자열) byte로 계산, 한글은 3byte char_length(문자열) 글자 수(공백 포함) 검색 instr(문자열, 문자) 글자 찾음, 대소문자 구분 X, 없으면 return = 0 posittion(문자 in 문자열) 글자.. 2022. 12. 20.
[MariaDB] 7. 연산자 및 기본 함수 논리 연산자 = 같다 , != 같지 않다 >, =, 2022. 12. 20.
[MariaDB] 6. data 추가, 삭제, 수정 data 추가 추가 insert into table명 values ( data, data, data, data); 일부 column에만 data 추가 insert into table명 (column명, column명) values (data, data); 여러 data추가 insert into table명 values (data,data),(data,data); data 확인 모두 확인 select * from table명; 특정 column 조회 select column명 from table명; 특정 data 조회 select column명 from table명 where column명 = data; data 수정 모든 data의 특정 column data값 수정 update table명 set col.. 2022. 12. 20.
[MariaDB] 5. column 추가, 삭제, 변경 column 추가 column 단일 추가 alter table table명 add column명 자료형; 여러 column 추가 add ( column , column); alter table table명 add ( column명 자료형, column명 자료형, ); column 확인 방법 1 : DESCRIBE table명; 방법 2 : desc table명; column 추가 위치 첫번 째로 column 추가 first alter table table명 add column명 자료형 first ; 특정 column 뒤에 추가 after 특정 column alter table table명 add column명 자료형 after 특정column ; column 삭제 column 삭제 drop column명.. 2022. 12. 20.
[MariaDB] 4. table 생성, 삭제, 변경, 복사 table 생성 table을 생성한다. column이 하나라도 있어야 생성되므로 column도 하나 만들어준다. create table tabel명 ( column명 VARCHAR(100) ); table 확인 show tab; table 삭제 table 삭제 drop table table명; table 이름 변경 이름 변경 rename table table명 to 변경할table명; table 복사 테이블 스키마 복사 create table new_table명 like old_table명 ; 테이블 스키마 & 데이터 복사 create table new_table명 (select * from old_table명); 데이터 복사 insert into receive_table명 (select * from s.. 2022. 12. 20.