human
Schema:
venue (venueId, venueName)
author (authorId, authorName)
dataset (datasetId, datasetName)
journal (journalId, journalName)
keyphrase (keyphraseId, keyphraseName)
paper (paperId, title, venueId, year, numCiting, numCitedBy, journalId)
cite (citingPaperId, citedPaperId)
paperDataset (paperId, datasetId)
paperKeyphrase (paperId, keyphraseId)
writes (paperId, authorId)
Please answer with SQL.
assistant
Sure, I understand.
human
How many papers are there ?
assistant
SELECT DISTINCT COUNT ( DISTINCT paperid ) FROM paper;
human
When was the last time Mary Crainie published a paper ?
assistant
SELECT DISTINCT MAX ( t3.year ) FROM writes AS t2 JOIN author AS t1 ON t2.authorid = t1.authorid JOIN paper AS t3 ON t2.paperid = t3.paperid WHERE t1.authorname = 'Mary Crainie';
human
papers published in the last year
assistant
SELECT DISTINCT paperid FROM paper WHERE YEAR = ( SELECT MAX ( YEAR ) FROM paper );
human
papers that are coauthored by Peter Mertens and Dina Barbian
assistant
SELECT DISTINCT t3.paperid FROM writes AS t3 JOIN author AS t2 ON t3.authorid = t2.authorid JOIN writes AS t4 ON t4.paperid = t3.paperid JOIN author AS t1 ON t4.authorid = t1.authorid WHERE t2.authorname = 'Peter Mertens' AND t1.authorname = 'Dina Barbian';
human
papers from 2014
assistant
SELECT DISTINCT paperid FROM paper WHERE YEAR = 2014;
human
sharon goldwater papers
assistant
SELECT DISTINCT t2.paperid FROM writes AS t2 JOIN author AS t1 ON t2.authorid = t1.authorid WHERE t1.authorname = "sharon goldwater" ;