Odd and Even Transactions
<p>Table: <code>transactions</code></p>

<pre>
+------------------+------+
| Column Name      | Type | 
+------------------+------+
| transaction_id   | int  |
| amount           | int  |
| transaction_date | date |
+------------------+------+
The transactions_id column uniquely identifies each row in this table.
Each row of this table contains the transaction id, amount and transaction date.
</pre>

<p>Write a solution to find the <strong>sum of amounts</strong> for <strong>odd</strong> and <strong>even</strong> transactions for each day. If there are no odd or even transactions for a specific date, display as <code>0</code>.</p>

<p>Return <em>the result table ordered by</em> <code>transaction_date</code> <em>in <strong>ascending</strong> order</em>.</p>

<p>The result format is in the following example.</p>

<p>&nbsp;</p>
<p><strong class="example">Example:</strong></p>

<div class="example-block">
<p><strong>Input:</strong></p>

<p><code>transactions</code> table:</p>

<pre class="example-io">
+----------------+--------+------------------+
| transaction_id | amount | transaction_date |
+----------------+--------+------------------+
| 1              | 150    | 2024-07-01       |
| 2              | 200    | 2024-07-01       |
| 3              | 75     | 2024-07-01       |
| 4              | 300    | 2024-07-02       |
| 5              | 50     | 2024-07-02       |
| 6              | 120    | 2024-07-03       |
+----------------+--------+------------------+
  </pre>

<p><strong>Output:</strong></p>

<pre class="example-io">
+------------------+---------+----------+
| transaction_date | odd_sum | even_sum |
+------------------+---------+----------+
| 2024-07-01       | 75      | 350      |
| 2024-07-02       | 0       | 350      |
| 2024-07-03       | 0       | 120      |
+------------------+---------+----------+
  </pre>

<p><strong>Explanation:</strong></p>

<ul>
	<li>For transaction dates:
	<ul>
		<li>2024-07-01:
		<ul>
			<li>Sum of amounts for odd transactions: 75</li>
			<li>Sum of amounts for even transactions: 150 + 200 = 350</li>
		</ul>
		</li>
		<li>2024-07-02:
		<ul>
			<li>Sum of amounts for odd transactions: 0</li>
			<li>Sum of amounts for even transactions: 300 + 50 = 350</li>
		</ul>
		</li>
		<li>2024-07-03:
		<ul>
			<li>Sum of amounts for odd transactions: 0</li>
			<li>Sum of amounts for even transactions: 120</li>
		</ul>
		</li>
	</ul>
	</li>
</ul>

<p><strong>Note:</strong> The output table is ordered by <code>transaction_date</code> in ascending order.</p>
</div>

[]
['Create table if not exists transactions ( transaction_id int, amount int, transaction_date date)', 'Truncate table transactions', "insert into transactions (transaction_id, amount, transaction_date) values ('1', '150', '2024-07-01')", "insert into transactions (transaction_id, amount, transaction_date) values ('2', '200', '2024-07-01')", "insert into transactions (transaction_id, amount, transaction_date) values ('3', '75', '2024-07-01')", "insert into transactions (transaction_id, amount, transaction_date) values ('4', '300', '2024-07-02')", "insert into transactions (transaction_id, amount, transaction_date) values ('5', '50', '2024-07-02')", "insert into transactions (transaction_id, amount, transaction_date) values ('6', '120', '2024-07-03')"]
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef sum_daily_odd_even(transactions: pd.DataFrame) -> pd.DataFrame:\n    "}, {"value": "postgresql", "text": "PostgreSQL", "defaultCode": "-- Write your PostgreSQL query statement below\n"}]
{"mysql": ["Create table if not exists transactions ( transaction_id int, amount int, transaction_date date)"], "mssql": ["Create table transactions ( transaction_id int, amount int, transaction_date date)"], "oraclesql": ["Create table  transactions ( transaction_id int, amount int, transaction_date date)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "database": true, "name": "sum_daily_odd_even", "postgresql": ["CREATE TABLE IF NOT EXISTS transactions (\n  transaction_id int,\n  amount int,\n  transaction_date date\n);\n"], "pythondata": ["transactions = pd.DataFrame(\n    columns=[\"transaction_id\", \"amount\", \"transaction_date\"],\n    dtype={\n        \"transaction_id\": \"int\",\n        \"amount\": \"int\",\n        \"transaction_date\": \"datetime64[ns]\",\n    },\n)\n"], "database_schema": {"transactions": {"transaction_id": "INT", "amount": "INT", "transaction_date": "DATE"}}}
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16</p>"]}
['Database']