Task: NL2SQL (source dataset: WikiSQL)

Natural language to SQL, also known as NL2SQL, is the problem of generating a SQL query that can be executed on a input table, for a given natural language question.

You will be given an input table called "table" in the markdown format, as well as a question. Your task is to generate an SQL query that can be executed on the input table to answer the question.

Please ensure that the generated SQL only return relevant columns being specifically asked in the question (e.g., in SQL please don't return more than one columns in SELECT if only one column is needed to answer the given question, and similarly please refrain from using SELECT * unless the entire row is needed to answer the question).
 
When generating SQL code, please use the SQLite syntax to ensure that your SQL is executable on SQLite3. Use only columns that are present in the table, always use quotes around your column and table names (some column names have punctuation or special characters), and refer to the columns using the column-names exactly as they appear in the table, do not add or remove punctuation (underscore, slash, etc.)

No explanation, return the code only with the following markdown codeblock format : ```sql<SQL CODE>```. For example, ```sql
SELECT * FROM "table"
``` is a valid format.

Table:
| Province                        | Capital        |   Population at 2010 Census |   Area (km²) |   Density (2010) | Geographical unit    |   Number of Cities (kota) |   Number of Regencies (kabupaten) |   Number of Districts (kecamatan) |   Villages |
|:--------------------------------|:---------------|----------------------------:|-------------:|-----------------:|:---------------------|--------------------------:|----------------------------------:|----------------------------------:|-----------:|
| special region of aceh          | banda aceh     |                     4494410 |        57956 |               77 | sumatra              |                         5 |                                18 |                               275 |       6420 |
| bali                            | denpasar       |                     3890757 |         5780 |              621 | lesser sunda islands |                         1 |                                 8 |                                57 |        698 |
| bangka-belitung                 | pangkal pinang |                     1223296 |        16424 |               64 | sumatra              |                         1 |                                 6 |                                43 |        361 |
| banten                          | serang         |                    10632166 |         9662 |              909 | java                 |                         4 |                                 4 |                               154 |       1530 |
| bengkulu                        | bengkulu       |                     1715518 |        19919 |               84 | sumatra              |                         1 |                                 9 |                               116 |       1442 |
| central java                    | semarang       |                    32382657 |        40800 |              894 | java                 |                         6 |                                29 |                               573 |       8577 |
| central kalimantan              | palangkaraya   |                     2212089 |       153564 |               14 | kalimantan           |                         1 |                                13 |                               120 |       1439 |
| central sulawesi                | palu           |                     2635009 |        61841 |               41 | sulawesi             |                         1 |                                10 |                               147 |       1712 |
| east java                       | surabaya       |                    37476757 |        47799 |              828 | java                 |                         9 |                                29 |                               662 |       8502 |
| east kalimantan                 | samarinda      |                     3026060 |       139462 |               22 | kalimantan           |                         3 |                                 6 |                                89 |       1023 |
| east nusa tenggara              | kupang         |                     4683827 |        48718 |               92 | lesser sunda islands |                         1 |                                20 |                               286 |       2775 |
| gorontalo                       | gorontalo      |                     1040164 |        11257 |               94 | sulawesi             |                         1 |                                 5 |                                65 |        595 |
| jakarta (special city district) | jakarta        |                     9607787 |          664 |            12786 | java                 |                         5 |                                 1 |                                44 |        267 |
| jambi                           | jambi          |                     3092265 |        50058 |               57 | sumatra              |                         2 |                                 9 |                               128 |       1319 |
| lampung                         | bandar lampung |                     7608405 |        34623 |              226 | sumatra              |                         2 |                                12 |                               206 |       2358 |
| maluku                          | ambon          |                     1533506 |        46914 |               32 | maluku islands       |                         2 |                                 9 |                                76 |        898 |
| north kalimantan                | tanjung selor  |                      622350 |        71176 |               10 | kalimantan           |                         1 |                                 4 |                                47 |        381 |
| north maluku                    | sofifi         |                     1038087 |        31982 |               31 | maluku islands       |                         2 |                                 7 |                               109 |       1041 |
| north sulawesi                  | manado         |                     2270596 |        13851 |              162 | sulawesi             |                         4 |                                11 |                               150 |       1510 |
| north sumatra                   | medan          |                    12982204 |        72981 |              188 | sumatra              |                         8 |                                25 |                               408 |       5649 |
| special region of papua         | jayapura       |                     2833381 |       319036 |                8 | western new guinea   |                         1 |                                28 |                               330 |       3583 |
| riau                            | pekanbaru      |                     5538367 |        87023 |               52 | sumatra              |                         2 |                                10 |                               153 |       1500 |
| riau islands                    | tanjung pinang |                     1679163 |         8201 |              208 | sumatra              |                         2 |                                 5 |                                59 |        331 |
| southeast sulawesi              | kendari        |                     2232586 |        38067 |               51 | sulawesi             |                         2 |                                10 |                               199 |       1843 |
| south kalimantan                | banjarmasin    |                     3626616 |        38744 |               96 | kalimantan           |                         2 |                                11 |                               151 |       1973 |
| south sulawesi                  | makassar       |                     8034776 |        46717 |              151 | sulawesi             |                         3 |                                26 |                               301 |       2874 |
| south sumatra                   | palembang      |                     7450394 |        91592 |               86 | sumatra              |                         4 |                                11 |                               217 |       2869 |
| west java                       | bandung        |                    43053732 |        35377 |             1176 | java                 |                         9 |                                17 |                               625 |       5827 |
| west kalimantan                 | pontianak      |                     4395983 |       147307 |               30 | kalimantan           |                         2 |                                12 |                               175 |       1777 |
| west nusa tenggara              | mataram        |                     4500212 |        18572 |              234 | lesser sunda islands |                         2 |                                 8 |                               116 |        913 |
| special region of west papua    | manokwari      |                      760422 |        97024 |                8 | western new guinea   |                         1 |                                10 |                               149 |       1291 |
| west sulawesi                   | mamuju         |                     1158651 |        16787 |               73 | sulawesi             |                         0 |                                 5 |                                66 |        564 |
| west sumatra                    | padang         |                     4846909 |        42012 |              110 | sumatra              |                         7 |                                12 |                               169 |        964 |
| special region of yogyakarta    | yogyakarta     |                     3457491 |         3133 |             1138 | java                 |                         1 |                                 4 |                                78 |        438 |

Question: What is the average number of regencies (kabupaten) with more than 331 villages and a 2010 population census of 12,982,204?

table_id: 2-170641-1
label: SELECT AVG("Number of Regencies (kabupaten)") FROM "table" WHERE "Villages" > 331 AND "Population at 2010 Census" = 12982204