일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 배열
- conda
- SVN
- sqlite
- if
- ngui
- dataframe
- pandas
- 쉘
- boost
- C++
- FIND
- Unity
- sql
- python
- autovacuum
- postgresql
- pi
- mysql
- awk
- Eclipse
- ubuntu
- List
- c++11
- expect
- Shader
- null
- with
- DROP
- SSH
- Today
- Total
목록sql (7)
その先にあるもの…
https://www.postgresql.org/docs/current/functions-array.html#ARRAY-FUNCTIONS-TABLE array_length ( anyarray, integer ) → integer Returns the length of the requested array dimension. (Produces NULL instead of 0 for empty or missing array dimensions.) array_length(array[1,2,3], 1) → 3 array_length(array[]::int[], 1) → NULL array_length(array['text'], 2) → NULL array_replace ( anycompatiblearray, an..
$ 유저 접속 psql -U 유저이름 -d db이름 PGPASSWORD=패스워드 psql -U 유저이름 -d db이름 $ 쿼리 실행 PGPASSWORD=패스워드 psql -U 유저이름 -d db이름 -c 'select * from table' $ 파일에 저장되어 있는 쿼리 실행 PGPASSWORD=패스워드 psql -U 유저이름 -d db이름 -f query.sql PGPASSWORD=패스워드 psql -U 유저이름 -d db이름 < query.sql $원격지 database접속 psql -h 000.000.000.000 -U 유저이름 -d db이름
column = { 1.0, 2.0, 3.0f } UPDATE table-name SET column[4:6] = '{4.0f, 5.0f, 6.0f}'; 구간을 지정해서 항목을 변경할 수 있다. https://wwwi.tistory.com/350
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#컬럼 값을 그룹핑하여 같은 값의 카운팅Select vend_id, count(*) as num_prodsFrom productsGroup by vend_id;----------------------------------------------------------------------------vend_id,num_prodsBRS01, 3DLL01, 4FNG01, 2 #group by절에는 원하는 만큼의 컬럼을 써서, 중첩 그룹을 만들 수 있다.#select 안에서 수식을 사용한다면, group by에도 같은 수식을 사용해야 한다.#..
테이블 필드 데이터 타입 변경ALTER TABLE db.tableName CHANGE COLUMN `필드이름` `필드이름` INT NOT NULL ; 테이블 필드 추가ALTER TABLE db.tableName ADD COLUMN `sumcolumn` INT NOT NULL AFTER `필드이름`;