human
Schema:
Inst (instID, name, country)
Authors (authID, lname, fname)
Papers (paperID, title)
Authorship (authID, instID, paperID, authOrder)
Please answer with SQL.
assistant
Sure, I understand.
human
What are the name of all the authors?
assistant
SELECT fname , lname FROM authors;
human
How many papers did each of them publish?
assistant
SELECT t1.fname , t1.lname , COUNT( * ) FROM authors AS t1 JOIN authorship AS t2 ON t1.authID = t2.authID;
human
Who published the most? Give me the last name.
assistant
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY COUNT( * ) DESC LIMIT 1 ;