Task: NL2SQL (source dataset: Spider)

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:
advertising_agencies

Tables:

Table: Agencies
|   agency_id | agency_details              |
|------------:|:----------------------------|
|           1 | Heller-Muller               |
|           2 | Bergstrom, Koss and Ebert   |
|           3 | Douglas-Langworth           |
|           4 | Fadel Group                 |
|           5 | White, Corwin and Rath      |
|           6 | Beatty-Sipes                |
|           7 | West, Grady and Durgan      |
|           8 | Hickle-Durgan               |
|           9 | Grant, Jaskolski and Brekke |
|          10 | Muller, Klein and Kunde     |


Table: Staff
|   staff_id |   agency_id | staff_details   |
|-----------:|------------:|:----------------|
|          1 |           6 | Rubie           |
|          2 |           7 | Sheridan        |
|          3 |          10 | Annabell        |
|          4 |           2 | Kendra          |
|          5 |           7 | Amara           |
|          6 |          15 | Lolita          |
|          7 |           2 | Hailie          |
|          8 |          14 | Armando         |
|          9 |          10 | Elroy           |
|         10 |           8 | Parker          |


Table: Clients
|   client_id |   agency_id | sic_code   | client_details   |
|------------:|------------:|:-----------|:-----------------|
|           1 |           8 | Mutual     | Alta             |
|           2 |           5 | Bad        | Mac              |
|           3 |           3 | Bad        | Johnpaul         |
|           4 |           5 | Bad        | Taurean          |
|           5 |          14 | Bad        | Lucie            |
|           6 |           8 | Mutual     | Rosa             |
|           7 |           9 | Mutual     | Kirsten          |
|           8 |           1 | Mutual     | Vincent          |
|           9 |           9 | Mutual     | Heber            |
|          10 |           9 | Mutual     | Callie           |


Table: Invoices
|   invoice_id |   client_id | invoice_status   | invoice_details   |
|-------------:|------------:|:-----------------|:------------------|
|            1 |           5 | Working          | excellent         |
|            2 |           9 | Starting         | good              |
|            3 |          15 | Starting         | excellent         |
|            4 |           8 | Starting         | ok                |
|            5 |           7 | Finish           | excellent         |
|            6 |           8 | Working          | excellent         |
|            7 |           7 | Finish           | excellent         |
|            8 |          14 | Finish           | excellent         |
|            9 |          12 | Starting         | good              |
|           10 |           2 | Finish           | excellent         |


Table: Meetings
|   meeting_id |   client_id | meeting_outcome   | meeting_type   |   billable_yn | start_date_time     | end_date_time       | purpose_of_meeting   | other_details   |
|-------------:|------------:|:------------------|:---------------|--------------:|:--------------------|:--------------------|:---------------------|:----------------|
|            1 |          15 | Report            | Team           |             0 | 2018-03-06 05:07:33 | 2018-03-21 09:26:41 | get proposal done    | 0               |
|            2 |           3 | Summary           | Group          |             0 | 2018-03-16 02:24:10 | 2018-03-21 17:57:59 | vote for solutions   | 0               |
|            3 |           4 | Summary           | Team           |             1 | 2018-03-06 21:02:06 | 2018-03-01 05:10:01 | get proposal done    | 0               |
|            4 |           5 | Vote results      | Company        |             1 | 2018-03-10 05:03:46 | 2018-02-25 23:20:12 | weekly report        | 0               |
|            5 |          14 | Summary           | Company        |             1 | 2018-02-26 18:35:24 | 2018-03-12 18:48:55 | weekly report        | 0               |
|            6 |           8 | Vote results      | Team           |             0 | 2018-03-20 08:56:47 | 2018-02-24 22:36:35 | weekly report        | absent staff    |
|            7 |          13 | Vote results      | Group          |             1 | 2018-03-01 22:20:09 | 2018-03-21 04:24:57 | vote for solutions   | 0               |
|            8 |           8 | Report            | Company        |             0 | 2018-03-16 06:38:16 | 2018-03-20 12:24:04 | weekly report        | 0               |
|            9 |           4 | Report            | Group          |             1 | 2018-03-18 15:35:54 | 2018-03-05 13:33:21 | weekly report        | 0               |
|           10 |           7 | Summary           | Team           |             0 | 2018-02-27 07:43:53 | 2018-02-27 02:40:21 | vote for solutions   | 0               |


Table: Payments
|   payment_id |   invoice_id | payment_details   |
|-------------:|-------------:|:------------------|
|            1 |            3 | MasterCard        |
|            2 |            5 | Visa              |
|            3 |            8 | Discover Card     |
|            4 |           11 | MasterCard        |
|            5 |           12 | Visa              |
|            6 |            9 | Visa              |
|            7 |           14 | Visa              |
|            8 |            2 | American Express  |
|            9 |            8 | Visa              |
|           10 |            8 | Visa              |


Table: Staff_in_Meetings
|   meeting_id |   staff_id |
|-------------:|-----------:|
|            6 |          7 |
|           14 |          3 |
|            4 |          5 |
|            1 |         11 |
|            2 |         10 |
|            9 |          1 |
|            8 |          3 |
|            8 |          7 |
|            8 |          6 |
|            3 |          5 |


Question: How many invoices are there for each status code?

db_id: advertising_agencies
tables: name: Agencies
data: Agencies.csv
name: Staff
data: Staff.csv
name: Clients
data: Clients.csv
name: Invoices
data: Invoices.csv
name: Meetings
data: Meetings.csv
name: Payments
data: Payments.csv
name: Staff_in_Meetings
data: Staff_in_Meetings.csv
label: SELECT invoice_status ,  count(*) FROM Invoices GROUP BY invoice_status
sqlite_path: $MMTU_HOME/data_sqlite/spider/spider_data/test_database/advertising_agencies/advertising_agencies.sqlite