zajicek=> select ename,max(hiredate) from emp; ERROR: Attribute emp.ename must be GROUPed or used in an aggregate function zajicek=> select ename,max(hiredate) from emp group by zajicek-> ; ERROR: parser: parse error at or near "" zajicek=> shit; ERROR: parser: parse error at or near "shit" zajicek=> select ename,hiredate,deptno from emp where (hiredate,deptno) in (sel zajicek=> shit; zajicek=> select ename,hiredate,deptno from emp where (hiredate,deptno) in (sel zajicek=> shit; zajicek=> shit; ERROR: parser: parse error at or near "shit" zajicek=> ; zajicek=> ; zajicek=> ; zajicek=> elect; ERROR: parser: parse error at or near "elect" zajicek=> select ename,hiredate,deptno from emp where (hiredate,deptno) in (sel ect min(hiredate),deptno from emp group by deptno); ename | hiredate | deptno -------+------------+-------- CLARK | 1981-06-09 | 10 ALLEN | 1981-02-20 | 30 SMITH | 1980-12-17 | 20 (3 rows) zajicek=> select ename,hiredate,deptno from emp where (hiredate,deptno) in (sel zajicek=> select ename, sal,deptno from emp zajicek=> select ename, sal,deptno from emp zajicek-> zajicek-> ; ename | sal | deptno --------+---------+-------- KING | 5000.00 | 10 BLAKE | 2850.00 | 30 CLARK | 1500.00 | 10 JONES | 2975.00 | 20 MARTIN | 1250.00 | 30 ALLEN | 1600.00 | 30 TURNER | 1500.00 | 30 JAMES | 950.00 | 30 WARD | 1250.00 | 30 FORD | 3000.00 | 20 SMITH | 800.00 | 20 SCOTT | 3000.00 | 20 ADAMS | 1100.00 | 20 MILLER | 1300.00 | 10 (14 rows) zajicek=> select ename, sal,deptno from emp x where sal>(select avg(sal) from e mp where deptno=x.deptno); ename | sal | deptno -------+---------+-------- KING | 5000.00 | 10 BLAKE | 2850.00 | 30 JONES | 2975.00 | 20 ALLEN | 1600.00 | 30 FORD | 3000.00 | 20 SCOTT | 3000.00 | 20 (6 rows) zajicek=> select ename, sal,deptno from emp x where sal>(select avg(sal) from e zajicek=> select ename, sal,deptno from emp x where sal>(select avg(sal) from e zajicek(> mp where deptno=x.deptno) zajicek(> mp where deptno=x.deptno) zajicek-> ; ERROR: Relation 'e' does not exist zajicek=> ; zajicek=> select ename, sal,deptno from emp x where sal>(select avg(sal) from e zajicek=> select ename, sal,deptno from emp x where sal>(select avg(sal) from e zajicek(> mp where deptno=x.deptno) zajicek(> mp where deptno=x.deptno) zajicek(> mp where deptno=x.deptno) zajicek(> mp where deptno=x.deptno) zajicek(> mp where deptno=x.deptno) zajicek-> ; ERROR: Relation 'e' does not exist zajicek=> select ename, sal,deptno from emp x where sal>(select avg(sal) from zajicek(> emp where deptno=x.deptno) zajicek(> em zajicek(> zajicek(> ; zajicek(> zajicek(> ; zajicek(> ; zajicek(> ; zajicek(> ; zajicek(> ) zajicek-> ; ERROR: parser: parse error at or near ";" zajicek=>