mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -9,24 +9,24 @@
|
||||
| operation_day | int |
|
||||
| price | int |
|
||||
+---------------+---------+
|
||||
(stock_name, operation_day) is the primary key for this table.
|
||||
The operation column is an ENUM of type ('Sell', 'Buy')
|
||||
(stock_name, operation_day) is the primary key (combination of columns with unique values) for this table.
|
||||
The operation column is an ENUM (category) of type ('Sell', 'Buy')
|
||||
Each row of this table indicates that the stock which has stock_name had an operation on the day operation_day with the price.
|
||||
It is guaranteed that each 'Sell' operation for a stock has a corresponding 'Buy' operation in a previous day. It is also guaranteed that each 'Buy' operation for a stock has a corresponding 'Sell' operation in an upcoming day.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p>Write an SQL query to report the <strong>Capital gain/loss</strong> for each stock.</p>
|
||||
<p>Write a solution to report the <strong>Capital gain/loss</strong> for each stock.</p>
|
||||
|
||||
<p>The <strong>Capital gain/loss</strong> of a stock is the total gain or loss after buying and selling the stock one or many times.</p>
|
||||
|
||||
<p>Return the result table in <strong>any order</strong>.</p>
|
||||
|
||||
<p>The query result format is in the following example.</p>
|
||||
<p>The result format is in the following example.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong>
|
||||
|
Reference in New Issue
Block a user