"content":"<p>Table: <code>Transactions</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| country | varchar |\n| state | enum |\n| amount | int |\n| trans_date | date |\n+---------------+---------+\nid is the primary key of this table.\nThe table has information about incoming transactions.\nThe state column is an enum of type ["approved", "declined"].\n</pre>\n\n<p> </p>\n\n<p>Write an SQL query to find for each month and country, the number of transactions and their total amount, the number of approved transactions and their total amount.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nTransactions table:\n+------+---------+----------+--------+------------+\n| id | country | state | amount | trans_date |\n+------+---------+----------+--------+------------+\n| 121 | US | approved | 1000 | 2018-12-18 |\n| 122 | US | declined | 2000 | 2018-12-19 |\n| 123 | US | approved | 2000 | 2019-01-01 |\n| 124 | DE | approved | 2000 | 2019-01-07 |\n+------+---------+----------+--------+------------+\n<strong>Output:</strong> \n+----------+---------+-------------+----------------+--------------------+-----------------------+\n| month | country | trans_count | approved_count | trans_total_amount | approved_total_amount |\n+----------+---------+-------------+----------------+--------------------+-----------------------+\n| 2018-12 | US | 2 | 1 | 3000 | 1000 |\n| 2019-01 | US | 1 | 1 | 2000 | 2000 |\n| 2019-01 | DE | 1 | 1 | 2000 | 2000 |\n+----------+---------+-------------+----------------+--------------------+-----------------------+\n</pre>\n",
"translatedTitle":"每月交易 I",
"translatedContent":"<p>表:<code>Transactions</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| country | varchar |\n| state | enum |\n| amount | int |\n| trans_date | date |\n+---------------+---------+\nid 是这个表的主键。\n该表包含有关传入事务的信息。\nstate 列类型为 [\"approved\", \"declined\"] 之一。\n</pre>\n\n<p> </p>\n\n<p>编写一个 sql 查询来查找每个月和每个国家/地区的事务数及其总金额、已批准的事务数及其总金额。</p>\n\n<p>以 <strong>任意顺序</strong> 返回结果表。</p>\n\n<p>查询结果格式如下所示。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<code><strong>输入:</strong>\nTransactions</code> table:\n+------+---------+----------+--------+------------+\n| id | country | state | amount | trans_date |\n+------+---------+----------+--------+------------+\n| 121 | US | approved | 1000 | 2018-12-18 |\n| 122 | US | declined | 2000 | 2018-12-19 |\n| 123 | US | approved | 2000 | 2019-01-01 |\n| 124 | DE | approved | 2000 | 2019-01-07 |\n+------+---------+----------+--------+------------+\n<strong>输出:</strong>\n+----------+---------+-------------+----------------+--------------------+-----------------------+\n| month | country | trans_count | approved_count | trans_total_amount | approved_total_amount |\n+----------+---------+-------------+----------------+--------------------+-----------------------+\n| 2018-12 | US | 2 | 1 | 3000 | 1000 |\n| 2019-01 | US | 1 | 1 | 2000 | 2000 |\n| 2019-01 | DE | 1 | 1 | 2000 | 2000 |\n+----------+---------+-------------+----------------+--------------------+-----------------------+</pre>\n",
"metaData":"{\"mysql\":[\"Create table If Not Exists Transactions (id int, country varchar(4), state enum('approved', 'declined'), amount int, trans_date date)\"],\"mssql\":[\"Create table Transactions (id int, country varchar(4), state varchar(10) check(state in ('approved', 'declined')), amount int, trans_date date)\"],\"oraclesql\":[\"Create table Transactions (id int, country varchar(4), state varchar(10) check(state in ('approved', 'declined')), amount int, trans_date date)\",\"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"],\"database\":true,\"name\":\"monthly_transactions\",\"pythondata\":[\"Transactions = pd.DataFrame([], columns=['id', 'country', 'state', 'amount', 'trans_date']).astype({'id':'Int64', 'country':'object', 'state':'object', 'amount':'Int64', 'trans_date':'datetime64[ns]'})\"],\"postgresql\":[\"Create table If Not Exists Transactions (id int, country varchar(4), state VARCHAR(30) CHECK (state IN ('approved', 'declined')), amount int, trans_date date)\\n\\n\"],\"database_schema\":{\"Transactions\":{\"id\":\"INT\",\"country\":\"VARCHAR(4)\",\"state\":\"ENUM('approved', 'declined')\",\"amount\":\"INT\",\"trans_date\":\"DATE\"}}}",
"judgerAvailable":true,
"judgeType":"large",
"mysqlSchemas":[
"Create table If Not Exists Transactions (id int, country varchar(4), state enum('approved', 'declined'), amount int, trans_date date)",