having 은 조건에 만족하지 않는 그룹 rows를 제거한다. HAVING은 WHERE과는 다르다: WHERE는 GROUP BY의 적용 전에 개별 rows를 필터하는 대신 HAVING는 GROUP BY에 의해 생성된 group rows를 필터한다.

(해석은 하는데 무슨 뜻이여...

일단은 생성하고 나서 하나하나 생성하냐, 아니면 그룹으로 묶이는 애들 레벨에서 미리 처리하냐 차이인가?)

HAVING Clause

The optional HAVING clause has the general form

where condition is the same as specified for the WHERE clause.

HAVING eliminates group rows that do not satisfy the condition. HAVING is different from WHERE: WHERE filters individual rows before the application of GROUP BY, while HAVING filters group rows created by GROUP BY. Each column referenced in condition must unambiguously reference a grouping column, unless the reference appears within an aggregate function or the ungrouped column is functionally dependent on the grouping columns.

The presence of HAVING turns a query into a grouped query even if there is no GROUP BY clause. This is the same as what happens when the query contains aggregate functions but no GROUP BY clause. All the selected rows are considered to form a single group, and the SELECT list and HAVING clause can only reference table columns from within aggregate functions. Such a query will emit a single row if the HAVING condition is true, zero rows if it is not true.

Currently, FOR NO KEY UPDATE, FOR UPDATE, FOR SHARE and FOR KEY SHARE cannot be specified with HAVING.

[링크 : https://www.postgresql.org/docs/9.5/sql-select.html]

Posted by 구차니

mysql 쪽에서는 당연히 쓰는거긴 한데.. postgresql 에서도 , 로 list를 적어 주면

자동으로 cartesian product(cross join)으로 결과를 내준다고 한다.

갑자기 cross join이 inner join인지 헷갈리네...

FROM Clause

The FROM clause specifies one or more source tables for the SELECT. If multiple sources are specified, the result is the Cartesian product (cross join) of all the sources. But usually qualification conditions are added (via WHERE) to restrict the returned rows to a small subset of the Cartesian product.

[링크 : https://www.postgresql.org/docs/9.5/sql-select.html#SQL-FROM]

 

 

+

inner join과 cross join은 다른듯

join_type

One of

  • [ INNER ] JOIN

  • LEFT [ OUTER ] JOIN

  • RIGHT [ OUTER ] JOIN

  • FULL [ OUTER ] JOIN

  • CROSS JOIN

[링크 :https://www.postgresql.org/docs/9.5/sql-select.html]

 

일단은.. cross join에 where를 주면 inner join이 되는건가? 좀 헷갈리네..

Join 종류

 설명

 Cross Join

 Outer Node 의 각 row 에 대해 Inner Node 의 모든 row가 결합되어 반환

 Inner Join

 Outer Node 의 각 row 에 대해 Inner Node 의 모든 row 중 Join 조건을 만족하는 row 에 대해서만 결합되어 반환

 Equi Join

 조건의 연산자가 = 인 경우
 Non Equi Join  조건의 연산자가 = 가 아닌 경우

[링크 : https://mozi.tistory.com/69]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

sql group by like?  (0) 2019.09.25
postgresql select having  (0) 2019.09.24
postgresql transaction begin / commit / rollback  (0) 2019.09.24
sql 문 계산하기  (0) 2019.09.24
string_agg() + COALESCE() + DISTINCT  (0) 2019.09.23
Posted by 구차니

BEGIN; 이 프로시저의 시작인줄 알았는데..

트랜잭션의 시작이었구나..

 

rollback을 위해서는 savepoint를 만들어 놔야하고

문제가 없으면 commit; 으로 transaction을 완료하면 된다.

BEGIN;
UPDATE accounts SET balance = balance - 100.00
    WHERE name = 'Alice';
SAVEPOINT my_savepoint;
UPDATE accounts SET balance = balance + 100.00
    WHERE name = 'Bob';
-- oops ... forget that and use Wally's account
ROLLBACK TO my_savepoint;
UPDATE accounts SET balance = balance + 100.00
    WHERE name = 'Wally';
COMMIT;

[링크 : https://www.postgresql.org/docs/8.3/tutorial-transactions.html]

 

근데.. 이렇게 하면 WAL 로 미친듯이 써질려나?

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql select having  (0) 2019.09.24
postgresql select from , (cross join)  (0) 2019.09.24
sql 문 계산하기  (0) 2019.09.24
string_agg() + COALESCE() + DISTINCT  (0) 2019.09.23
join where와 on  (0) 2019.09.18
Posted by 구차니
Programming/node.js2019. 9. 24. 17:53

테스트용 was나 하나 짜볼까나...

 

[링크 : https://araikuma.tistory.com/459]

 

+ 2019.12.10

[링크 : https://node-postgres.com/]

'Programming > node.js' 카테고리의 다른 글

node.js JWT with refresh token  (0) 2019.12.10
node.js synchornous file write  (0) 2019.11.06
json2csv / node.js 에서 NULL 값 출력하기  (0) 2019.09.18
js nested function과 변수 scope  (0) 2019.09.15
node.js util.format / sprintf?  (0) 2019.09.10
Posted by 구차니

값이 integer면 - 해서 계산해도 된다.

우옹.. 신기하당...

 

[링크 : https://blog.naver.com/kimnx9006/220573722518]

Posted by 구차니
개소리 왈왈/컴퓨터2019. 9. 24. 14:13

회사에서 주인 없는 후지츠 U1010과 빌립 S5 발견

 

 

둘다 배터리 어댑터 없어서 이래저래 사야 하는데 후지츠 꺼는 옥션에서 1.5만에 어댑터 발견

하지만 배터리는 너무 오래된 녀석이라 없는듯 한데..

 

일단은 1.8인치 EIDE 하드..

어디서 본 것 같은 사이즈라서 예전글 보니 2710p의 하드가 ZIF EIDE 타입 하드.. 케이블 문제로 쉽진 않을듯 하니 고민..

 

멀 하든 돈 낭비에 시간낭비 일거 같은데.. 왜이렇게 이거 탐나냐.. ㅠㅠ

나온지도 12년이 된 박물관으로 가야할 녀석인데 말이야... ㅠㅠ

 

[링크 : https://katastrophos.net/.../installing-ubuntu-10-10-maverick-meerkat-on-fujitsu-u820-u2010-u2020/]

[링크 : http://www.kpug.kr/kpugfreeboard/973625]

'개소리 왈왈 > 컴퓨터' 카테고리의 다른 글

viliv S5 i-LOG  (2) 2019.09.28
계륵과 딜레마  (4) 2019.09.27
z68 보트 메모리 슬롯 불량?  (0) 2019.09.22
ADATA SSD toolbox  (0) 2019.07.14
아내의 첫(?) SSD 경험  (4) 2019.07.07
Posted by 구차니

-c로는 안되고

-o Cipher로는 되네

[링크 : https://www.tweaked.io/guide/scp/]

'프로그램 사용 > ssh scp sftp' 카테고리의 다른 글

ssh 원격 명령어 실행  (0) 2021.09.29
reverse ssh  (0) 2021.01.03
ssh tunnel proxy  (0) 2019.09.20
ssh remote port forwarding  (0) 2019.01.28
reverse SSH  (0) 2018.05.14
Posted by 구차니