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

who has the most publications in question answering ?
SELECT DISTINCT COUNT(paper.paperid), writes.authorid FROM keyphrase, paper, paperkeyphrase, writes WHERE keyphrase.keyphrasename = 'question answering' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.paperid = paper.paperid GROUP BY writes.authorid ORDER BY COUNT(paper.paperid) DESC
SELECT DISTINCT COUNT("paper"."paperid"), "writes"."authorid" FROM "keyphrase" JOIN "paperkeyphrase" ON "keyphrase"."keyphraseid" = "paperkeyphrase"."keyphraseid" JOIN "paper" ON "paper"."paperid" = "paperkeyphrase"."paperid" JOIN "writes" ON "paper"."paperid" = "writes"."paperid" WHERE "keyphrase"."keyphrasename" = 'question answering' GROUP BY "writes"."authorid" ORDER BY COUNT("paper"."paperid") DESC NULLS LAST