본문 바로가기

DataBase19

[PostgreSQL] SCHEMA CREATE, ALTER, DROP SCHEMA -- 스키마 생성 CREATE SCHEMA schema_name AUTHORIZATION username; -- 스키마 이름 변경 ALTER SCHEMA schema_name RENAME TO new_schema_name; -- 스키마 소유자 변경 ALTER SCHEMA username OWNER TO new_username; -- 스키마 삭제 DROP SCHEMA schema_name CASCADE; 2019. 6. 11.
[PostgreSQL] Import CSV File Into Table 방법1 COPY 테이블명(컬럼명...) FROM 'CSV 파일 경로' DELIMITER ',' CSV HEADER; 방법2 ㄴtable 우클릭 ㄴImport/Export... ㄴImport/Export 버튼 클릭하여 Import로 전환 ㄴFile Info 에서 파일정보 가져오기 ㄴMiscellaneous >>> Header >>> No를 Yes로 전환 ㄴDelimiter 설정 ㄴOK버튼 누르기 Reference http://www.postgresqltutorial.com/import-csv-file-into-posgresql-table/ Import CSV File Into PosgreSQL Table www.postgresqltutorial.com 2019. 6. 11.
[PostgreSQL] collate LC_COLLATE 이는 매우 중요한 것으로 다음과 같은 것에 영향을 미친다. 대소문자를 구분하는 기능. 문자열 정렬 ‘like’ 문에서 인덱스를 사용여부 결정 이는 데이터베이스를 생성할때에도 지정할 수가 있는데, 지정하는 방법은 locale 과 같이 language_territory.codeset 형식이지만 codeset 은 생략하는 경우가 있다. 다음과 같은 명령어로 확인 가능하다. SHOW lc_collate; 위의 명령어를 검색하면 Data Output에서 "Korean_Korea.949" 로 나온다. 문제는 이 LC_COLLATE 는 initdb 시에 한번 결정이 되면 바꿀 수 없고 하지만, Template 을 1번이 아닌 0번으로 할 경우에는 가능하다. Template1 은 initdb 때 생.. 2019. 6. 11.
[PostgreSQL] character varying 와 varchar 차이점 표기법 varchar(n) 및 char(n)은 각각 character varying(n) 및 character(n)의 별명이다. 둘 다 똑같지만 많은 데이터베이스가 주로 postgreSQL이 제공하는 다양한 문자를 제공하지 않는다. 따라서 Oracle Postgre 및 DB2와 같은 다중 데이터베이스의 경우 Varchar를 사용하는 것이 좋다. Reference http://www.postgresqltutorial.com/postgresql-char-varchar-text/ PostgreSQL Character Types: CHAR, VARCHAR, And TEXT www.postgresqltutorial.com https://stackoverflow.com/questions/1199468/what-is.. 2019. 6. 11.