human
Schema:
Scientists (SSN, Name)
Projects (Code, Name, Hours)
AssignedTo (Scientist, Project)
Please answer with SQL.
assistant
Sure, I understand.
human
find the hours spent on the project that has continued for the longest time.
assistant
SELECT MAX( hours ) FROM projects;
human
what is the name of this project?
assistant
SELECT name FROM projects ORDER BY hours DESC LIMIT 1;
human
Find the SSN and name of scientists who are assigned to it.
assistant
SELECT T3.ssn , T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = ( SELECT MAX( hours ) FROM projects ) ;