CREATE TABLE "w" (
  "index" INTEGER,
  "name" TEXT,
  "province" TEXT,
  "city" TEXT,
  "year" TEXT,
  "remarks" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index                      name          province     city year                                                         remarks
     0       abdul rahman mosque    kabul province    kabul 2009                                   largest mosque in afghanistan
     1 friday mosque of kandahar kandahar province kandahar 1750                houses the cloak of the islamic prophet muhammad
     2     omar al-farooq mosque kandahar province kandahar 2014 built on the site that was a popular cinema of kandahar . [ 1 ]
*/

Here are some values that may be useful: w.city ( herat ) , documents.title ( herat , fire temple )
Q: Who were the builders of the mosque in Herat with fire temples ?
BlendSQL:
{{
    LLMQA(
        'Who were the builders of the mosque?',
        (
            SELECT documents.title AS 'Building', documents.content FROM documents
            JOIN {{
                LLMJoin(
                    left_on='w::name',
                    right_on='documents::title'
                )
            }}
            WHERE w.city = 'herat' AND w.remarks LIKE '%fire temple%'
        )
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "camp name" TEXT,
  "council" TEXT,
  "location" TEXT,
  "status" TEXT,
  "notes" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index                             camp name                    council                       location status                                                                                                                                                     notes
     0 camp aquila ( formerly camp mauwehu ) connecticut yankee council candlewood lake , sherman , ct closed                                                  located on candlewood lake in sherman , ct. , the camp was sold in 1982 along with camp toquam in goshen
     1                      camp cochipianee       bristol area council                    goshen , ct closed the camp was founded in 1928 by the bristol area council and was sold after the new britain area council and the bristol area council were merged in 1972
     2                           camp irving         housatonic council                   shelton , ct closed             the camp was located in shelton in the birchbank area along the housatonic river . it was closed in 1945 and the buildings were razed in 1948
*/

Q: What is the status of the camp in the town that split from Stonington in 1724 ?
BlendSQL:
SELECT status FROM w WHERE location = {{
    LLMQA(
        'Which town split from Stonington in 1724?',
        (
            SELECT title, content FROM documents
                WHERE documents MATCH 'stonington'
        ),
        options='w::location'
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "no" INTEGER,
  "rider" TEXT,
  "team" TEXT,
  "motorcycle" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index  no          rider                 team      motorcycle
     0   1   carl fogarty   ducati performance      ducati 996
     1   4 akira yanagawa kawasaki racing team kawasaki zx-7rr
     2   5  colin edwards        castrol honda      honda rc45
*/

Q: After what season did the number 7 competitor retire ?
BlendSQL:
{{
    LLMQA(
        'When did the competitor retire?',
        (
            SELECT documents.title AS 'Competitor', documents.content FROM documents
            JOIN {{
                LLMJoin(
                    left_on='w::rider',
                    right_on='documents::title'
                )
            }}
            WHERE w.no = 7
        )
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "year" TEXT,
  "winner" TEXT,
  "position" TEXT,
  "school" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index    year         winner   position     school
     0 1961-62       ron ryan right wing      colby
     1 1962-63 bob brinkworth     center rensselaer
     2 1963-64 bob brinkworth     center rensselaer
*/

Here are some values that may be useful: w.year ( 1971-72 )
Q: What year was the 1971-72 ECAC Hockey Player of the Year born ?
BlendSQL:
{{
    LLMQA(
        'What year was the player born?',
        (
            SELECT documents.title AS 'Player', documents.content FROM documents
            JOIN {{
                LLMJoin(
                    left_on = 'w::winner',
                    right_on = 'documents::title'
                )
            }}
            WHERE w.year = '1971-72'
        )
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "name" TEXT,
  "unit" TEXT,
  "date of action" TEXT,
  "place of action" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index              name                     unit          date of action                                 place of action
     0     william allan 24 24th regiment of foot  1879-2-22 22-1879-1-23          battle of rorke s drift , natal colony
     1 william beresford            9 9th lancers    1879-7-3 3 july 1879 white umfolozi river ( near ulundi ) , zululand
     2     anthony booth 80 80th regiment of foot 1879-3-12 12 march 1879                   battle of intombe , transvaal
*/

Q: What battle did the man born on 7 December 1839 fight in ?
BlendSQL:
SELECT {{LLMMap('Name of the battle?', 'w::place of action')}} FROM w WHERE name = {{
    LLMQA(
        'Who was born on 7 December 1839?',
        (
            SELECT documents.title, documents.content FROM documents JOIN {{
                LLMJoin(
                    left_on='w::name',
                    right_on='documents::title'
                )
            }}
        )
        options = 'w::name'
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "name" TEXT,
  "location" TEXT,
  "type" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index            name        location                              type
     0    allianz park hendon , london rugby union and athletics stadium
     1        kia oval      kennington                   cricket stadium
     2 banks s stadium         walsall                  football stadium
*/

Here are some values that may be useful: w.name ( kia oval )
Q: What is the borough in which Kia Oval is located ?
BlendSQL:
{{
    LLMQA(
        'What borough is the Kia Oval located in?',
        (
            SELECT documents.title, documents.content FROM documents
            JOIN {{
                LLMJoin(
                    left_on='w::name',
                    right_on='documents::title'
                )
            }} WHERE w.name = 'kia oval'
        )
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "venue" TEXT,
  "sports" TEXT,
  "capacity" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index                venue                                                                     sports   capacity
     0           bjela\u0161nica                                                      alpine skiing ( men ) not listed
     1   igman , malo polje                              nordic combined ( ski jumping ) , ski jumping not listed
     2 igman , veliko polje biathlon , cross-country skiing , nordic combined ( cross-country skiing ) not listed
*/

Q: What is the capacity of the venue that was named in honor of Juan Antonio Samaranch in 2010 after his death ?
BlendSQL:
SELECT capacity FROM w WHERE venue = {{
    LLMQA(
        'Which venue was named in honor of Juan Antonio Samaranch after his death?',
        (SELECT title AS 'Venue', content FROM documents WHERE documents MATCH 'juan OR antonio OR samaranch')

    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "round ( pick )" TEXT,
  "name" TEXT,
  "position" TEXT,
  "school" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index round ( pick )           name             position                 school
     0       1 ( 20 )  joshua fields right-handed pitcher  university of georgia
     1       2 ( 20 )   dennis raben           outfielder    university of miami
     2       3 ( 98 ) aaron pribanic right-handed pitcher university of nebraska
*/

Here are some values that may be useful: w.school ( university of georgia ) , documents.title ( university of georgia )
Q: Which teams has the player drafted by the Seattle Mariners in 2008 out of University of Georgia played for in the MLB ?
BlendSQL:
{{
    LLMQA(
        'Which teams drafted this player?',
        (
            SELECT documents.title AS 'Player', documents.content FROM documents
            JOIN {{
                LLMJoin(
                    left_on='w::name',
                    right_on='documents::title'
                )
            }}
            WHERE w.school = 'university of georgia'
        )
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "rank" INTEGER,
  "film" TEXT,
  "year" INTEGER,
  "director" TEXT,
  "studio ( s )" TEXT,
  "worldwide gross" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index  rank                  film  year             director                                       studio ( s )                worldwide gross
     0     1       amazon obhijaan  2017 kamaleswar mukherjee                              shree venkatesh films \u20b9 48.63 crore ( us $ 6800000 )
     1     2         chander pahar  2013 kamaleswar mukherjee                              shree venkatesh films    \u20b9 15 crore ( us $ 2100000 )
     2     3 boss 2 : back to rule  2017           baba yadav jeetz fireworks walzen media works jaaz multimedia  \u20b9 10.5 crore ( us $ 1500000 )
*/

Q: The story of a cab driver witnessing a murder by a criminal kingpin leads to extensive loss in an Indian film directed by one of the leading ad film makers in Kolkata who has made how many ad films in his career ?
BlendSQL:
{{
    LLMQA(
        'How many ad films has this director made in their carer?',
        (
            SELECT documents.title AS 'Director', documents.content FROM documents
            JOIN {{
                LLMJoin(
                    left_on='w::director',
                    right_on='documents::title'
                )
            }} WHERE w.film = {{
                LLMQA(
                    'Which film is about a cab driver witnessing a murder by a criminal kingpin?',
                    (SELECT title, content FROM documents WHERE documents MATCH 'cab OR murder OR kingpin'),
                    options='w::film'
                )
            }}
        )
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "medal" TEXT,
  "name" TEXT,
  "sport" TEXT,
  "event" TEXT,
  "time/score" TEXT,
  "date" TEXT
)
/*
3 example rows:
SELECT * FROM "w" LIMIT 3
 index medal                                     name               sport                   event time/score    date
     0  gold andrew gemmell sean ryan ashley twichell open water swimming         5 km team event     57:0.6 july 21
     1  gold                             dana vollmer            swimming women s 100 m butterfly      56.87 july 25
     2  gold                              ryan lochte            swimming   men s 200 m freestyle    1:44.44 july 26
*/

Q: What is the name of the oldest person whose result , not including team race , was above 2 minutes ?
BlendSQL:
{{
    LLMQA(
        'Of the athletes here, who is older?',
        (
            SELECT DISTINCT documents.title AS 'Athlete', documents.content FROM documents
            JOIN {{
                LLMJoin(
                    left_on='w::name',
                    right_on='documents::title'
                )
            }} WHERE {{
                LLMMap('Is this time greater than 2 minutes?', 'w::time/score')
            }} = TRUE AND {{
                LLMMap('Is this a team race?', 'w::event')
            }} = FALSE
        )
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "year" INTEGER,
  "award" TEXT,
  "category" TEXT,
  "nominated work" TEXT,
  "result" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index  year                                      award                                                category    nominated work    result
     0  2013           critics  choice television award             best supporting actor in a movie/miniseries political animals nominated
     1  2013                           gold derby award                          tv movie/mini supporting actor political animals nominated
     2  2013 online film & television association award best supporting actor in a motion picture or miniseries political animals nominated
*/

Q: How many social media sites are used to gather votes for the 2016 award ?
BlendSQL:
{{
    LLMQA(
        'How many social media sites are used to gather votes?',
        (
            select documents.title, documents.content from documents
                JOIN {{
                    LLMJoin(
                        left_on='w::award',
                        right_on='documents::title'
                    )
                }} WHERE w.year = 2016
        )
    )
}}

---

CREATE TABLE "w" (
  "index" INTEGER,
  "date" TEXT,
  "language" TEXT,
  "language family" TEXT,
  "region" TEXT
)
/*
3 example rows:
SELECT * FROM w LIMIT 3
 index                     date language language family      region
     0 early 2nd millennium bce sumerian         isolate mesopotamia
     1       2nd millennium bce  eblaite         semitic       syria
     2            ca . 1100 bce  hittite       anatolian    anatolia
*/

Here are some values that may be useful: w.region ( mesopotamia ) , documents.title ( mesopotamia )
Q: What was the language family that was used in Hattusa , as well as parts of the northern Levant and Upper Mesopotamia ?
BlendSQL:
SELECT "language family" FROM w
WHERE language = {{
    LLMQA(
        'Which language was used in Hattusa, as well as parts of the northern Levant and Upper Mesopotamia ?',
        (SELECT title, content FROM documents WHERE documents MATCH 'hattusa'),
        options='w::language'
    )
}}