taoyds / spider

scripts and baselines for Spider: Yale complex and cross-domain semantic parsing and text-to-SQL challenge
https://yale-lily.github.io/spider
Apache License 2.0
812 stars 193 forks source link

Ambiguity of SQL #12

Closed GaoyanCheerup closed 5 years ago

GaoyanCheerup commented 5 years ago

For this question below, why it is labeled as the first SQL, instead of the second one: What are the names and ids of artists with 3 or more albums, listed in alphabetical order? SELECT T2.Name , T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT() >= 3 ORDER BY T2.Name SELECT T2.Name , T2.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT() >= 3 ORDER BY T2.Name

Thanks :)

GaoyanCheerup commented 5 years ago

Similar cases, why the SQL of this sentence is T1.customer_id instead of T2.customer_id: Return the id and full name of the customer who has the fewest accounts. SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1

taoyds commented 5 years ago

Hi,

We accept the foreign keys in both tables in our evaluation. So both T1.customer_id and T2.customer_id work.

Best, Tao