| {"task_id": "django-000", "category": "filtering", "prompt": "Return the titles of every Book published in 2015 or later, ordered by title ascending, as a list of 1-tuples.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Harbour Math\"], [\"Lantern Grammar\"], [\"Nine Quiet Engines\"], [\"Salt and Signal\"], [\"Small Machines\"], [\"The Cartographer\"], [\"The Fifth Harvest\"], [\"The Long Ledger\"]]}"} | |
| {"task_id": "django-001", "category": "filtering", "prompt": "Return (title, year) for every Book that is NOT in stock, ordered by year ascending.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Iron Meridian\", 2012], [\"Harbour Math\", 2016], [\"Salt and Signal\", 2019]]}"} | |
| {"task_id": "django-002", "category": "filtering", "prompt": "Return the titles of Books whose title contains the word 'The' (case-sensitive), ordered by title.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"The Cartographer\"], [\"The Fifth Harvest\"], [\"The Long Ledger\"]]}"} | |
| {"task_id": "django-003", "category": "filtering", "prompt": "Return (title, pages) for Books with more than 400 pages, ordered by pages descending.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"The Cartographer\", 640], [\"Lantern Grammar\", 590], [\"Salt and Signal\", 512], [\"The Long Ledger\", 460], [\"The Fifth Harvest\", 428], [\"Iron Meridian\", 402]]}"} | |
| {"task_id": "django-004", "category": "filtering", "prompt": "Using a Q object, return the titles of Books that are either published before 2012 OR have more than 600 pages, ordered by title.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Static Tides\"], [\"The Cartographer\"], [\"Winter Protocols\"]]}"} | |
| {"task_id": "django-005", "category": "filtering", "prompt": "Return the titles of Books that are in stock AND published before 2015, ordered by title.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Paper Orbits\"], [\"Static Tides\"], [\"Winter Protocols\"]]}"} | |
| {"task_id": "django-006", "category": "filtering", "prompt": "Return the titles of Books whose year is one of 2011, 2016 or 2021, ordered by year ascending.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Static Tides\"], [\"Harbour Math\"], [\"Lantern Grammar\"]]}"} | |
| {"task_id": "django-007", "category": "filtering", "prompt": "Return (title, year) for Books published between 2013 and 2018 inclusive, ordered by year then title.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Paper Orbits\", 2013], [\"The Long Ledger\", 2015], [\"Harbour Math\", 2016], [\"Nine Quiet Engines\", 2018]]}"} | |
| {"task_id": "django-008", "category": "filtering", "prompt": "Return the titles of Books EXCLUDING those by the author named 'Cleo Rivas', ordered by title.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Iron Meridian\"], [\"Nine Quiet Engines\"], [\"Paper Orbits\"], [\"Salt and Signal\"], [\"Small Machines\"], [\"Static Tides\"], [\"The Fifth Harvest\"], [\"The Long Ledger\"], [\"Winter Protocols\"]]}"} | |
| {"task_id": "django-009", "category": "relations", "prompt": "Return (book title, author name) for every Book, ordered by book title.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Harbour Math\", \"Cleo Rivas\"], [\"Iron Meridian\", \"Dan Okafor\"], [\"Lantern Grammar\", \"Cleo Rivas\"], [\"Nine Quiet Engines\", \"Bo Nakamura\"], [\"Paper Orbits\", \"Bo Nakamura\"], [\"Salt and Signal\", \"Ada Ellis\"], [\"Small Machines\", \"Eve Lindqvist\"], [\"Static Tides\", \"Ada Ellis\"], [\"The Cartographer\", \"Cleo Rivas\"], [\"The Fifth Harvest\", \"Eve Lindqvist\"], [\"The Long Ledger\", \"Ada Ellis\"], [\"Winter Protocols\", \"Dan Okafor\"]]}"} | |
| {"task_id": "django-010", "category": "relations", "prompt": "Return (book title, publisher name) for Books whose publisher is in the US, ordered by title.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Nine Quiet Engines\", \"Cedar House\"], [\"Paper Orbits\", \"Cedar House\"], [\"Salt and Signal\", \"Aurora Press\"], [\"Small Machines\", \"Cedar House\"], [\"Static Tides\", \"Aurora Press\"], [\"Winter Protocols\", \"Aurora Press\"]]}"} | |
| {"task_id": "django-011", "category": "relations", "prompt": "Return the names of Authors who have at least one Book that is out of stock, with no duplicates, ordered by name.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Ada Ellis\"], [\"Cleo Rivas\"], [\"Dan Okafor\"]]}"} | |
| {"task_id": "django-012", "category": "relations", "prompt": "Return the names of Publishers that have published at least one Book with more than 500 pages, deduplicated and ordered by name.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Aurora Press\"], [\"Delta Books\"]]}"} | |
| {"task_id": "django-013", "category": "relations", "prompt": "Return (author name, book title) for Books published by 'Delta Books', ordered by book title.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Cleo Rivas\", \"Lantern Grammar\"], [\"Cleo Rivas\", \"The Cartographer\"], [\"Eve Lindqvist\", \"The Fifth Harvest\"]]}"} | |
| {"task_id": "django-014", "category": "relations", "prompt": "Return the names of Authors born before 1980 who have published with a publisher in GB, deduplicated and ordered by name.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Ada Ellis\"], [\"Dan Okafor\"]]}"} | |
| {"task_id": "django-015", "category": "aggregation", "prompt": "Return a single 1-tuple containing the total number of Books.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[12]]}"} | |
| {"task_id": "django-016", "category": "aggregation", "prompt": "Return (author name, number of books) for every Author, ordered by author name.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Ada Ellis\", 3], [\"Bo Nakamura\", 2], [\"Cleo Rivas\", 3], [\"Dan Okafor\", 2], [\"Eve Lindqvist\", 2]]}"} | |
| {"task_id": "django-017", "category": "aggregation", "prompt": "Return (publisher name, number of books) for publishers with 3 or more books, ordered by publisher name.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Aurora Press\", 3], [\"Blue Heron\", 3], [\"Cedar House\", 3], [\"Delta Books\", 3]]}"} | |
| {"task_id": "django-018", "category": "aggregation", "prompt": "Return (author name, total pages across their books) for every Author, ordered by author name.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Ada Ellis\", 1292], [\"Bo Nakamura\", 598], [\"Cleo Rivas\", 1474], [\"Dan Okafor\", 570], [\"Eve Lindqvist\", 784]]}"} | |
| {"task_id": "django-019", "category": "aggregation", "prompt": "Return (author name, max book year) for every Author, ordered by author name.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Ada Ellis\", 2019], [\"Bo Nakamura\", 2018], [\"Cleo Rivas\", 2021], [\"Dan Okafor\", 2012], [\"Eve Lindqvist\", 2023]]}"} | |
| {"task_id": "django-020", "category": "aggregation", "prompt": "Return (publisher name, average book pages rounded to 2 decimals as a float) for every Publisher, ordered by publisher name.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Aurora Press\", 333.33], [\"Blue Heron\", 368.67], [\"Cedar House\", 318.0], [\"Delta Books\", 552.67]]}"} | |
| {"task_id": "django-021", "category": "aggregation", "prompt": "Return (publisher country, number of books published from that country) for every country with at least 2 books, ordered by country.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"GB\", 3], [\"JP\", 3], [\"US\", 6]]}"} | |
| {"task_id": "django-022", "category": "aggregation", "prompt": "Return a single 1-tuple with the number of DISTINCT authors that have at least one book in stock.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[5]]}"} | |
| {"task_id": "django-023", "category": "expressions", "prompt": "Using an F expression, return the titles of Books whose pages are greater than 20 times their year's last two digits — concretely, compare pages to (year - 2000) * 20 — ordered by title. Assume every year is 2000 or later.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Iron Meridian\"], [\"Lantern Grammar\"], [\"Nine Quiet Engines\"], [\"Salt and Signal\"], [\"Static Tides\"], [\"The Cartographer\"], [\"The Long Ledger\"]]}"} | |
| {"task_id": "django-024", "category": "expressions", "prompt": "Return (title, price as a float) for the 3 most expensive Books, ordered by price descending.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"The Cartographer\", 42.0], [\"Lantern Grammar\", 38.1], [\"The Fifth Harvest\", 34.5]]}"} | |
| {"task_id": "django-025", "category": "expressions", "prompt": "Return (title, pages) for the 5 Books with the fewest pages, ordered by pages ascending then title ascending.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Winter Protocols\", 168], [\"Paper Orbits\", 210], [\"Harbour Math\", 244], [\"Static Tides\", 320], [\"Small Machines\", 356]]}"} | |
| {"task_id": "django-026", "category": "expressions", "prompt": "Return the titles of Books ordered by author name ascending then year descending.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Salt and Signal\"], [\"The Long Ledger\"], [\"Static Tides\"], [\"Nine Quiet Engines\"], [\"Paper Orbits\"], [\"Lantern Grammar\"], [\"The Cartographer\"], [\"Harbour Math\"], [\"Iron Meridian\"], [\"Winter Protocols\"], [\"The Fifth Harvest\"], [\"Small Machines\"]]}"} | |
| {"task_id": "django-027", "category": "expressions", "prompt": "Return (author name, birth year) for Authors, ordered by birth year descending, limited to the 3 youngest.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[\"Eve Lindqvist\", 1990], [\"Cleo Rivas\", 1982], [\"Bo Nakamura\", 1975]]}"} | |
| {"task_id": "django-028", "category": "expressions", "prompt": "Return a single 1-tuple with the sum of all book prices as a float rounded to 2 decimals.", "schema": "Models (app label `bookshop`):\n\n class Publisher(models.Model):\n name = CharField(max_length=64)\n country = CharField(max_length=2)\n\n class Author(models.Model):\n name = CharField(max_length=64)\n birth_year = IntegerField()\n\n class Book(models.Model):\n title = CharField(max_length=128)\n author = ForeignKey(Author, related_name=\"books\")\n publisher = ForeignKey(Publisher, related_name=\"books\")\n year = IntegerField()\n price = DecimalField(max_digits=6, decimal_places=2)\n pages = IntegerField()\n in_stock = BooleanField(default=True)\n", "fixture": "{\"publishers\": [[1, \"Aurora Press\", \"US\"], [2, \"Blue Heron\", \"GB\"], [3, \"Cedar House\", \"US\"], [4, \"Delta Books\", \"JP\"]], \"authors\": [[1, \"Ada Ellis\", 1968], [2, \"Bo Nakamura\", 1975], [3, \"Cleo Rivas\", 1982], [4, \"Dan Okafor\", 1959], [5, \"Eve Lindqvist\", 1990]], \"books\": [[1, \"Static Tides\", 1, 1, 2011, \"18.50\", 320, true], [2, \"The Long Ledger\", 1, 2, 2015, \"24.00\", 460, true], [3, \"Salt and Signal\", 1, 1, 2019, \"31.25\", 512, false], [4, \"Paper Orbits\", 2, 3, 2013, \"12.99\", 210, true], [5, \"Nine Quiet Engines\", 2, 3, 2018, \"27.40\", 388, true], [6, \"Harbour Math\", 3, 2, 2016, \"15.75\", 244, false], [7, \"The Cartographer\", 3, 4, 2020, \"42.00\", 640, true], [8, \"Lantern Grammar\", 3, 4, 2021, \"38.10\", 590, true], [9, \"Winter Protocols\", 4, 1, 2009, \"9.99\", 168, true], [10, \"Iron Meridian\", 4, 2, 2012, \"22.30\", 402, false], [11, \"Small Machines\", 5, 3, 2022, \"29.95\", 356, true], [12, \"The Fifth Harvest\", 5, 4, 2023, \"34.50\", 428, true]]}", "expected_output": "{\"rows\": [[306.73]]}"} | |