Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- join
- docker container
- Dockerfile
- springboot
- DB
- 설치
- systemd
- 파일 시스템
- ps
- Docker
- mac mariadb
- install
- 도커파일
- spring framework
- mysql
- sudo
- 도커
- react map error
- jdk
- Access denied for user ''@'localhost'
- map is not a function
- mysql error
- springboot jar
- 관리
- root
- sts
- jar deploy
- Oracle
- jar배포
- brew install mariadb
Archives
- Today
- Total
Yoon.s
[mssql][oracle] 문자열 합치기 - concat, || 본문
SQL Server
보통 문자열 합칠 때 concat 함수 or 더하기(+) 연산자 사용
concat 함수 사용을 권장
- 입력된 값을 문자형으로 변환 후, 합치는 작업 진행
- => 숫자와 문자가 함께 입력되어도 오류 발생 X (더하기 연산자는 문자+숫자 오류 발생)
- 문자 파라미터는 254개 까지 입력이 가능
concat_ws : 구분자로 합치기
select concat('hello', 'apple', 123) as str1; -- helloapple123
select concat_ws(',', 'hello', 'apple', 123) as str2; -- hello,apple,123
select concat(player_id, ',', player_name) as '이름' from player; -- 결과 아래
*저 사이가 엄청 빈거는 player_id를 char(7)을 줘서 고정값이 생겨버림.
Oracle
concat 함수 혹은 || 을 사용함 .
실무에서는 ||을 더 많이 사용함.
select 'Hello ' || 'world' as st from player2;
select concat('Hello ', 'world') as st from player2;
select PLAYER_ID || ',' ||PLAYER_NAME from player2;
'백 > DB' 카테고리의 다른 글
공백제거: TRIM, LTRIM, RTRIM (0) | 2023.03.07 |
---|---|
[mssql] 시작하기 (0) | 2023.03.03 |
mysql에서 발생했던 오류들 정리 (0) | 2021.01.08 |
[mysql] Access denied for user ''@'localhost' 오류 (0) | 2020.10.03 |
[mysql] mariaDB 시작하기 (0) | 2020.10.01 |
Comments