Skip to content

Commit 4f8dd3c

Browse files
corrected schema
1 parent 5be421a commit 4f8dd3c

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

Capital Gain-Loss/schema.sql

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
Create Table If Not Exists Stocks (stock_name varchar(15), operation ENUM('Sell', 'Buy'), operation_day int, price int)
2-
Truncate table Stocks
3-
insert into Stocks (stock_name, operation, operation_day, price) values ('Leetcode', 'Buy', '1', '1000')
4-
insert into Stocks (stock_name, operation, operation_day, price) values ('Corona Masks', 'Buy', '2', '10')
5-
insert into Stocks (stock_name, operation, operation_day, price) values ('Leetcode', 'Sell', '5', '9000')
6-
insert into Stocks (stock_name, operation, operation_day, price) values ('Handbags', 'Buy', '17', '30000')
7-
insert into Stocks (stock_name, operation, operation_day, price) values ('Corona Masks', 'Sell', '3', '1010')
8-
insert into Stocks (stock_name, operation, operation_day, price) values ('Corona Masks', 'Buy', '4', '1000')
9-
insert into Stocks (stock_name, operation, operation_day, price) values ('Corona Masks', 'Sell', '5', '500')
10-
insert into Stocks (stock_name, operation, operation_day, price) values ('Corona Masks', 'Buy', '6', '1000')
11-
insert into Stocks (stock_name, operation, operation_day, price) values ('Handbags', 'Sell', '29', '7000')
12-
insert into Stocks (stock_name, operation, operation_day, price) values ('Corona Masks', 'Sell', '10', '10000')
1+
CREATE TABLE IF NOT EXISTS Stocks (
2+
stock_name VARCHAR(15),
3+
operation VARCHAR(4) CHECK (operation IN ('Sell', 'Buy')),
4+
operation_day INT,
5+
price INT
6+
);
7+
8+
TRUNCATE TABLE Stocks;
9+
10+
INSERT INTO
11+
Stocks (stock_name, operation, operation_day, price)
12+
VALUES
13+
('Leetcode', 'Buy', '1', '1000'),
14+
('Corona Masks', 'Buy', '2', '10'),
15+
('Leetcode', 'Sell', '5', '9000'),
16+
('Handbags', 'Buy', '17', '30000'),
17+
('Corona Masks', 'Sell', '3', '1010'),
18+
('Corona Masks', 'Buy', '4', '1000'),
19+
('Corona Masks', 'Sell', '5', '500'),
20+
('Corona Masks', 'Buy', '6', '1000'),
21+
('Handbags', 'Sell', '29', '7000'),
22+
('Corona Masks', 'Sell', '10', '10000');

0 commit comments

Comments
 (0)