테이블 형식 없이 SQL 쿼리 결과 가져오기
예를 들면--disable-column-names
옵션, 테이블 형식 없이 SQL 쿼리를 가져올 수 있는 옵션이 있습니까?예를 들어 다음과 같습니다.
mysql -u username -p password --disable-column-names --execute "select name from test"
다음 결과:
-----
| A |
| B |
| C |
| D |
-----
표 형식 없이 아래와 같은 sql 프로그램 옵션 수식자를 사용하여 조회 결과를 얻을 수 있습니까?
나는 이것을 원한다:
A
B
C
D
를 추가합니다.-B
에 깃발을 올리다.mysql
.
mysql -B -u username -ppassword \
--disable-column-names \
--execute "select name from mydb.test"
-B, --batch: Print results in nontabular output format.
--execute: Execute the statement and quit.
주의:-B
/--batch
또, 이네이블로 하겠습니다--silent
전환합니다.
다른 응답은 부수적으로 동작하지만 올바른 스위치는-s
의 줄임말인--silent
.
추가 지정이 필요할 수 있습니다.-r
위해서--raw
출력은 문자 이스케이프도 디세블로 합니다.그렇지 않으면 newline, tab, null char 및 backslash는 각각 \n, \t, \0 및 \로 표시됩니다.
· --silent, -s Silent mode. Produce less output. This option can be given multiple times to produce less and less output. This option results in nontabular output format and escaping of special characters. Escaping may be disabled by using raw mode; see the description for the --raw option. · --raw, -r For tabular output, the “boxing” around columns enables one column value to be distinguished from another. For nontabular output (such as is produced in batch mode or when the --batch or --silent option is given), special characters are escaped in the output so they can be identified easily. Newline, tab, NUL, and backslash are written as \n, \t, \0, and \\. The --raw option disables this character escaping. The following example demonstrates tabular versus nontabular output and the use of raw mode to disable escaping: % mysql mysql> SELECT CHAR(92); +----------+ | CHAR(92) | +----------+ | \ | +----------+ % mysql -s mysql> SELECT CHAR(92); CHAR(92) \\ % mysql -s -r mysql> SELECT CHAR(92); CHAR(92) \
- Oracle Corporation
MySQL 5.7 06/07/2018
언급URL : https://stackoverflow.com/questions/16711598/get-the-sql-query-result-without-the-table-format
'programing' 카테고리의 다른 글
카운터를 값별로 정렬하는 방법- 비단뱀 (0) | 2023.01.01 |
---|---|
Java에서 2배에서 정수로 변환 (0) | 2023.01.01 |
Python에서 다양한 날짜로 반복 (0) | 2023.01.01 |
String을 Title Case로 변환하는 방법이 있나요? (0) | 2023.01.01 |
JDBC 유형에 대한 방언 매핑 없음: 1111 (0) | 2023.01.01 |