test=# create table vorlesungen(prof_id int, fach_id int);
CREATE TABLE
test=*# copy vorlesungen from stdin;
Geben Sie die zu kopierenden Daten ein, gefolgt von einem Zeilenende.
Beenden Sie mit einem Backslash und einem Punkt alleine auf einer Zeile.
>> 1 1
>> 1 3
>> 1 5
>> 1 6
>> 2 2
>> 2 4
>> 5 7
>> \.
COPY 7
test=*# select prof_id, count(fach_id) from vorlesungen group by prof_id having count(fach_id) >= 3;
prof_id | count
---------+-------
1 | 4
(1 Zeile)
test=*#