Task: NL2SQL (source dataset: bird)

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.

Database:
california_schools

Tables:

Table: frpm
|       CDSCode | Academic Year   |   County Code |   District Code |   School Code | County Name   | District Name                      | School Name                                   | District Type                    | School Type                 | Educational Option Type   | NSLP Provision Status   |   Charter School (Y/N) | Charter School Number   | Charter Funding Type   |   IRC | Low Grade   |   High Grade |   Enrollment (K-12) |   Free Meal Count (K-12) |   Percent (%) Eligible Free (K-12) |   FRPM Count (K-12) |   Percent (%) Eligible FRPM (K-12) |   Enrollment (Ages 5-17) |   Free Meal Count (Ages 5-17) |   Percent (%) Eligible Free (Ages 5-17) |   FRPM Count (Ages 5-17) |   Percent (%) Eligible FRPM (Ages 5-17) |   2013-14 CALPADS Fall 1 Certification Status |
|--------------:|:----------------|--------------:|----------------:|--------------:|:--------------|:-----------------------------------|:----------------------------------------------|:---------------------------------|:----------------------------|:--------------------------|:------------------------|-----------------------:|:------------------------|:-----------------------|------:|:------------|-------------:|--------------------:|-------------------------:|-----------------------------------:|--------------------:|-----------------------------------:|-------------------------:|------------------------------:|----------------------------------------:|-------------------------:|----------------------------------------:|----------------------------------------------:|
| 1100170109835 | 2014-2015       |             1 |           10017 |        109835 | Alameda       | Alameda County Office of Education | FAME Public Charter                           | County Office of Education (COE) | K-12 Schools (Public)       | Traditional               |                         |                      1 | 0728                    | Directly funded        |     1 | K           |           12 |                1087 |                      565 |                          0.519779  |                 715 |                          0.657774  |                     1070 |                           553 |                               0.516822  |                      702 |                               0.656075  |                                             1 |
| 1100170112607 | 2014-2015       |             1 |           10017 |        112607 | Alameda       | Alameda County Office of Education | Envision Academy for Arts & Technology        | County Office of Education (COE) | High Schools (Public)       | Traditional               |                         |                      1 | 0811                    | Directly funded        |     1 | 9           |           12 |                 395 |                      186 |                          0.470886  |                 186 |                          0.470886  |                      376 |                           182 |                               0.484043  |                      182 |                               0.484043  |                                             1 |
| 1100170118489 | 2014-2015       |             1 |           10017 |        118489 | Alameda       | Alameda County Office of Education | Aspire California College Preparatory Academy | County Office of Education (COE) | High Schools (Public)       | Traditional               |                         |                      1 | 1049                    | Directly funded        |     1 | 9           |           12 |                 244 |                      134 |                          0.54918   |                 175 |                          0.717213  |                      230 |                           128 |                               0.556522  |                      168 |                               0.730435  |                                             1 |
| 1100170123968 | 2014-2015       |             1 |           10017 |        123968 | Alameda       | Alameda County Office of Education | Community School for Creative Education       | County Office of Education (COE) | Elementary Schools (Public) | Traditional               | Breakfast Provision 2   |                      1 | 1284                    | Directly funded        |     1 | K           |            8 |                 191 |                      113 |                          0.591623  |                 139 |                          0.727749  |                      190 |                           113 |                               0.594737  |                      139 |                               0.731579  |                                             1 |
| 1100170124172 | 2014-2015       |             1 |           10017 |        124172 | Alameda       | Alameda County Office of Education | Yu Ming Charter                               | County Office of Education (COE) | Elementary Schools (Public) | Traditional               |                         |                      1 | 1296                    | Directly funded        |     1 | K           |            8 |                 257 |                       14 |                          0.0544747 |                  21 |                          0.0817121 |                      257 |                            14 |                               0.0544747 |                       21 |                               0.0817121 |                                             1 |
| 1100170125567 | 2014-2015       |             1 |           10017 |        125567 | Alameda       | Alameda County Office of Education | Urban Montessori Charter                      | County Office of Education (COE) | Elementary Schools (Public) | Traditional               |                         |                      1 | 1383                    | Directly funded        |     1 | K           |            8 |                 279 |                       81 |                          0.290323  |                 101 |                          0.362007  |                      273 |                            78 |                               0.285714  |                       98 |                               0.358974  |                                             1 |
| 1100170130401 | 2014-2015       |             1 |           10017 |        130401 | Alameda       | Alameda County Office of Education | Alameda County Juvenile Hall/Court            | County Office of Education (COE) | Juvenile Court Schools      | Juvenile Court School     |                         |                      0 |                         |                        |     0 | K           |           12 |                 181 |                       71 |                          0.392265  |                  73 |                          0.403315  |                      160 |                            66 |                               0.4125    |                       68 |                               0.425     |                                             1 |
| 1100170130419 | 2014-2015       |             1 |           10017 |        130419 | Alameda       | Alameda County Office of Education | Alameda County Community                      | County Office of Education (COE) | County Community            | County Community School   |                         |                      0 |                         |                        |     0 | K           |           12 |                 277 |                      190 |                          0.685921  |                 223 |                          0.805054  |                      221 |                           145 |                               0.656109  |                      172 |                               0.778281  |                                             1 |
| 1100176001788 | 2014-2015       |             1 |           10017 |       6001788 | Alameda       | Alameda County Office of Education | Cox Academy                                   | County Office of Education (COE) | Elementary Schools (Public) | Traditional               |                         |                      1 | 0740                    | Directly funded        |     1 | K           |            5 |                 597 |                      493 |                          0.825796  |                 557 |                          0.932998  |                      586 |                           483 |                               0.824232  |                      546 |                               0.931741  |                                             1 |
| 1100176002000 | 2014-2015       |             1 |           10017 |       6002000 | Alameda       | Alameda County Office of Education | Lazear Charter Academy                        | County Office of Education (COE) | Elementary Schools (Public) | Traditional               | Provision 2             |                      1 | 1464                    | Directly funded        |     1 | K           |            8 |                 437 |                      336 |                          0.768879  |                 400 |                          0.915332  |                      437 |                           336 |                               0.768879  |                      400 |                               0.915332  |                                             1 |


Table: satscores
|           cds | rtype   | sname                                         | dname                              | cname   |   enroll12 |   NumTstTakr | AvgScrRead   | AvgScrMath   | AvgScrWrite   | NumGE1500   |
|--------------:|:--------|:----------------------------------------------|:-----------------------------------|:--------|-----------:|-------------:|:-------------|:-------------|:--------------|:------------|
| 1100170000000 | D       |                                               | Alameda County Office of Education | Alameda |        398 |           88 | 418.0        | 418.0        | 417.0         | 14.0        |
| 1100170109835 | S       | FAME Public Charter                           | Alameda County Office of Education | Alameda |         62 |           17 | 503.0        | 546.0        | 505.0         | 9.0         |
| 1100170112607 | S       | Envision Academy for Arts & Technology        | Alameda County Office of Education | Alameda |         75 |           71 | 397.0        | 387.0        | 395.0         | 5.0         |
| 1100170118489 | S       | Aspire California College Preparatory Academy | Alameda County Office of Education | Alameda |         61 |            0 |              |              |               |             |
| 1611190000000 | D       |                                               | Alameda Unified                    | Alameda |        922 |          544 | 521.0        | 546.0        | 519.0         | 333.0       |
| 1611190106401 | S       | Alameda Science and Technology Institute      | Alameda Unified                    | Alameda |         36 |           36 | 562.0        | 590.0        | 555.0         | 29.0        |
| 1611190119222 | S       | Nea Community Learning Center                 | Alameda Unified                    | Alameda |         12 |            6 |              |              |               |             |
| 1611190130229 | S       | Alameda High                                  | Alameda Unified                    | Alameda |        465 |          325 | 543.0        | 573.0        | 543.0         | 229.0       |
| 1611190130609 | S       | Alameda Community Learning Center             | Alameda Unified                    | Alameda |         26 |           20 | 575.0        | 593.0        | 581.0         | 16.0        |
| 1611190130625 | S       | Alternatives in Action                        | Alameda Unified                    | Alameda |         41 |           23 | 352.0        | 350.0        | 343.0         | 1.0         |


Table: schools
|       CDSCode |   NCESDist | NCESSchool   | StatusType   | County   | District                           | School                                        | Street                           | StreetAbr                     | City        | Zip        | State   | MailStreet                       | MailStrAbr                    | MailCity    | MailZip    | MailState   | Phone          | Ext   | Website                                     | OpenDate   | ClosedDate   | Charter   | CharterNum   | FundingType     |   DOC | DOCType                          | SOC   | SOCType                     | EdOpsCode   | EdOpsName               | EILCode   | EILName                     | GSoffered   | GSserved   | Virtual   | Magnet   | Latitude   | Longitude   | AdmFName1   | AdmLName1   | AdmEmail1                                         | AdmFName2   | AdmLName2   | AdmEmail2   | AdmFName3   | AdmLName3   | AdmEmail3   | LastUpdate   |
|--------------:|-----------:|:-------------|:-------------|:---------|:-----------------------------------|:----------------------------------------------|:---------------------------------|:------------------------------|:------------|:-----------|:--------|:---------------------------------|:------------------------------|:------------|:-----------|:------------|:---------------|:------|:--------------------------------------------|:-----------|:-------------|:----------|:-------------|:----------------|------:|:---------------------------------|:------|:----------------------------|:------------|:------------------------|:----------|:----------------------------|:------------|:-----------|:----------|:---------|:-----------|:------------|:------------|:------------|:--------------------------------------------------|:------------|:------------|:------------|:------------|:------------|:------------|:-------------|
| 1100170000000 |    0691051 |              | Active       | Alameda  | Alameda County Office of Education |                                               | 313 West Winton Avenue           | 313 West Winton Ave.          | Hayward     | 94544-1136 | CA      | 313 West Winton Avenue           | 313 West Winton Ave.          | Hayward     | 94544-1136 | CA          | (510) 887-0152 |       | www.acoe.org                                |            |              |           |              |                 |     0 | County Office of Education (COE) |       |                             |             |                         |           |                             |             |            |           |          | 37.658212  | -122.09713  | L Karen     | Monroe      | lkmonroe@acoe.org                                 |             |             |             |             |             |             | 2015-06-23   |
| 1100170109835 |    0691051 | 10546        | Closed       | Alameda  | Alameda County Office of Education | FAME Public Charter                           | 39899 Balentine Drive, Suite 335 | 39899 Balentine Dr., Ste. 335 | Newark      | 94560-5359 | CA      | 39899 Balentine Drive, Suite 335 | 39899 Balentine Dr., Ste. 335 | Newark      | 94560-5359 | CA          |                |       |                                             | 2005-08-29 | 2015-07-31   | 1.0       | 0728         | Directly funded |     0 | County Office of Education (COE) | 65    | K-12 Schools (Public)       | TRAD        | Traditional             | ELEMHIGH  | Elementary-High Combination | K-12        | K-12       | P         | 0.0      | 37.521436  | -121.99391  |             |             |                                                   |             |             |             |             |             |             | 2015-09-01   |
| 1100170112607 |    0691051 | 10947        | Active       | Alameda  | Alameda County Office of Education | Envision Academy for Arts & Technology        | 1515 Webster Street              | 1515 Webster St.              | Oakland     | 94612-3355 | CA      | 1515 Webster Street              | 1515 Webster St.              | Oakland     | 94612      | CA          | (510) 596-8901 |       | www.envisionacademy.org/                    | 2006-08-28 |              | 1.0       | 0811         | Directly funded |     0 | County Office of Education (COE) | 66    | High Schools (Public)       | TRAD        | Traditional             | HS        | High School                 | 9-12        | 9-12       | N         | 0.0      | 37.80452   | -122.26815  | Laura       | Robell      | laura@envisionacademy.org                         |             |             |             |             |             |             | 2015-06-18   |
| 1100170118489 |    0691051 | 12283        | Closed       | Alameda  | Alameda County Office of Education | Aspire California College Preparatory Academy | 2125 Jefferson Avenue            | 2125 Jefferson Ave.           | Berkeley    | 94703-1414 | CA      | 1001 22nd Avenue, Suite 100      | 1001 22nd Ave., Ste. 100      | Oakland     | 94606      | CA          |                |       | www.aspirepublicschools.org                 | 2008-08-21 | 2015-06-30   | 1.0       | 1049         | Directly funded |     0 | County Office of Education (COE) | 66    | High Schools (Public)       | TRAD        | Traditional             | HS        | High School                 | 9-12        | 9-12       | N         | 0.0      | 37.868991  | -122.27844  |             |             |                                                   |             |             |             |             |             |             | 2015-07-01   |
| 1100170123968 |    0691051 | 12844        | Active       | Alameda  | Alameda County Office of Education | Community School for Creative Education       | 2111 International Boulevard     | 2111 International Blvd.      | Oakland     | 94606-4903 | CA      | 2111 International Boulevard     | 2111 International Blvd.      | Oakland     | 94606-4903 | CA          | (510) 686-4131 |       | www.communityschoolforcreativeeducation.org | 2011-08-22 |              | 1.0       | 1284         | Directly funded |     0 | County Office of Education (COE) | 60    | Elementary Schools (Public) | TRAD        | Traditional             | ELEM      | Elementary                  | K-8         | K-7        | N         | 0.0      | 37.784648  | -122.23863  | Clifford    | Thompson    | cliffordt@communityschoolforcreativeeducation.org |             |             |             |             |             |             | 2016-07-18   |
| 1100170124172 |    0691051 | 12901        | Active       | Alameda  | Alameda County Office of Education | Yu Ming Charter                               | 1086 Alcatraz Avenue             | 1086 Alcatraz Ave.            | Oakland     | 94608-1265 | CA      | 1086 Alcatraz Avenue             | 1086 Alcatraz Ave.            | Oakland     | 94608-1265 | CA          | (510) 452-2063 |       | www.yumingschool.org                        | 2011-08-09 |              | 1.0       | 1296         | Directly funded |     0 | County Office of Education (COE) | 60    | Elementary Schools (Public) | TRAD        | Traditional             | ELEM      | Elementary                  | K-8         | K-5        | N         | 0.0      | 37.847375  | -122.28356  | Sue         | Park        | spark@yumingschool.org                            |             |             |             |             |             |             | 2016-05-10   |
| 1100170125567 |    0691051 | 13008        | Active       | Alameda  | Alameda County Office of Education | Urban Montessori Charter                      | 5328 Brann Street                | 5328 Brann St.                | Oakland     | 94619-3312 | CA      | 5328 Brann Street                | 5328 Brann St.                | Oakland     | 94619-3312 | CA          | (510) 842-1181 |       | www.urbanmontessori.org                     | 2012-08-27 |              | 1.0       | 1383         | Directly funded |     0 | County Office of Education (COE) | 60    | Elementary Schools (Public) | TRAD        | Traditional             | ELEM      | Elementary                  | K-8         | K-5        | N         | 0.0      | 37.778352  | -122.1895   | David       | Castillo    | davidc@urbanmontessori.org                        |             |             |             |             |             |             | 2015-10-09   |
| 1100170130302 |    0691051 |              | Closed       | Alameda  | Alameda County Office of Education | Technical, Agricultural & Nat.                | 597 C Street                     | 597 C St.                     | Hayward     | 94541      | CA      | 597 C Street                     | 597 C St.                     | Hayward     | 94541      | CA          |                |       |                                             | 1980-07-01 | 1989-06-30   | 0.0       |              |                 |     0 | County Office of Education (COE) | 10    | County Community            |             |                         | UG        | Ungraded                    |             |            |           |          |            |             |             |             |                                                   |             |             |             |             |             |             | 1999-06-24   |
| 1100170130401 |    0691051 | 09264        | Active       | Alameda  | Alameda County Office of Education | Alameda County Juvenile Hall/Court            | 2500 Fairmont Avenue             | 2500 Fairmont Ave.            | San Leandro | 94578-1005 | CA      | 2500 Fairmont Avenue             | 2500 Fairmont Ave.            | San Leandro | 94578-1005 | CA          | (510) 667-7435 |       | www.acoe.org                                | 1980-07-01 |              | 0.0       |              |                 |     0 | County Office of Education (COE) | 14    | Juvenile Court Schools      | JUV         | Juvenile Court School   | HS        | High School                 | K-12        | 8-12       | N         | 0.0      | 37.712878  | -122.11173  | Michael     | Hermosillo  | mhermosillo@acoe.org                              |             |             |             |             |             |             | 2016-05-10   |
| 1100170130419 |    0691051 | 06830        | Active       | Alameda  | Alameda County Office of Education | Alameda County Community                      | 313 West Winton Avenue           | 313 West Winton Ave.          | Hayward     | 94544-1136 | CA      | 313 West Winton Avenue           | 313 West Winton Ave.          | Hayward     | 94544-1136 | CA          | (510) 670-4590 |       | www.acoe.org                                | 1980-07-01 |              | 0.0       |              |                 |     0 | County Office of Education (COE) | 10    | County Community            | COMM        | County Community School | HS        | High School                 | K-12        | 7-12       | P         | 0.0      | 37.658212  | -122.09713  | Carolyn     | Hobbs       | chobbs@acoe.org                                   |             |             |             |             |             |             | 2016-10-06   |


Question: What is the phone number and extension number for the school that had the 333rd highest average writing score?

db_id: california_schools
tables: name: frpm
data: frpm.csv
name: satscores
data: satscores.csv
name: schools
data: schools.csv
label: SELECT T2.Phone, T2.Ext FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode ORDER BY T1.AvgScrWrite DESC LIMIT 332, 1
sqlite_path: $MMTU_HOME/data_sqlite/bird/dev_20240627/dev_databases/california_schools/california_schools.sqlite