CREATE TABLE writes (paperid NUMBER, authorid NUMBER)
CREATE TABLE journal (journalid NUMBER, journalname VARCHAR2)
CREATE TABLE paperdataset (paperid NUMBER, datasetid NUMBER)
CREATE TABLE venue (venueid NUMBER, venuename VARCHAR2)
CREATE TABLE author (authorid NUMBER, authorname VARCHAR2)
CREATE TABLE paperfield (fieldid NUMBER, paperid NUMBER)
CREATE TABLE paper (paperid NUMBER, title VARCHAR2, venueid NUMBER, year NUMBER, numciting NUMBER, numcitedby NUMBER, journalid NUMBER)
CREATE TABLE cite (citingpaperid NUMBER, citedpaperid NUMBER)
CREATE TABLE dataset (datasetid NUMBER, datasetname VARCHAR2)
CREATE TABLE field (fieldid NUMBER)
CREATE TABLE keyphrase (keyphraseid NUMBER, keyphrasename VARCHAR2)
CREATE TABLE paperkeyphrase (paperid NUMBER, keyphraseid NUMBER)

Who has published both in ICML and ACL ?
SELECT DISTINCT writes.authorid FROM paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename IN ('ICML', 'ACL') AND writes.paperid = paper.paperid GROUP BY writes.authorid HAVING COUNT(DISTINCT venue.venueid) = 2
SELECT DISTINCT "writes"."authorid" FROM "paper" JOIN "venue" ON "paper"."venueid" = "venue"."venueid" AND "venue"."venuename" IN ('ICML', 'ACL') JOIN "writes" ON "paper"."paperid" = "writes"."paperid" GROUP BY "writes"."authorid" HAVING COUNT(DISTINCT "venue"."venueid") = 2