Skip to content

Commit 904455f

Browse files
Corrected the Schema
1 parent 6d78703 commit 904455f

File tree

4 files changed

+146
-30
lines changed

4 files changed

+146
-30
lines changed
Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,40 @@
1-
Create table If Not Exists Queue (person_id int, person_name varchar(30), weight int, turn int)
2-
Truncate table Queue
3-
insert into Queue (person_id, person_name, weight, turn) values ('5', 'Alice', '250', '1')
4-
insert into Queue (person_id, person_name, weight, turn) values ('4', 'Bob', '175', '5')
5-
insert into Queue (person_id, person_name, weight, turn) values ('3', 'Alex', '350', '2')
6-
insert into Queue (person_id, person_name, weight, turn) values ('6', 'John Cena', '400', '3')
7-
insert into Queue (person_id, person_name, weight, turn) values ('1', 'Winston', '500', '6')
8-
insert into Queue (person_id, person_name, weight, turn) values ('2', 'Marie', '200', '4')
1+
CREATE TABLE IF NOT EXISTS Queue (
2+
person_id int,
3+
person_name varchar(30),
4+
weight int,
5+
turn int
6+
);
7+
8+
TRUNCATE TABLE Queue;
9+
10+
INSERT INTO
11+
Queue (person_id, person_name, weight, turn)
12+
VALUES
13+
('5', 'Alice', '250', '1');
14+
15+
INSERT INTO
16+
Queue (person_id, person_name, weight, turn)
17+
VALUES
18+
('4', 'Bob', '175', '5');
19+
20+
INSERT INTO
21+
Queue (person_id, person_name, weight, turn)
22+
VALUES
23+
('3', 'Alex', '350', '2');
24+
25+
INSERT INTO
26+
Queue (person_id, person_name, weight, turn)
27+
VALUES
28+
('6', 'John Cena', '400', '3');
29+
30+
INSERT INTO
31+
Queue (person_id, person_name, weight, turn)
32+
VALUES
33+
('1', 'Winston', '500', '6');
34+
35+
INSERT INTO
36+
Queue (person_id, person_name, weight, turn)
37+
VALUES
38+
('2', 'Marie', '200', '4');
39+
40+
COMMIT;
Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,40 @@
1-
Create table If Not Exists Employee (id int, name varchar(255), department varchar(255), managerId int)
2-
Truncate table Employee
3-
insert into Employee (id, name, department, managerId) values ('101', 'John', 'A', 'None')
4-
insert into Employee (id, name, department, managerId) values ('102', 'Dan', 'A', '101')
5-
insert into Employee (id, name, department, managerId) values ('103', 'James', 'A', '101')
6-
insert into Employee (id, name, department, managerId) values ('104', 'Amy', 'A', '101')
7-
insert into Employee (id, name, department, managerId) values ('105', 'Anne', 'A', '101')
8-
insert into Employee (id, name, department, managerId) values ('106', 'Ron', 'B', '101')
1+
CREATE TABLE IF NOT EXISTS Employee (
2+
id int,
3+
name varchar(255),
4+
department varchar(255),
5+
managerId int
6+
);
7+
8+
TRUNCATE TABLE Employee;
9+
10+
INSERT INTO
11+
Employee (id, name, department, managerId)
12+
VALUES
13+
('101', 'John', 'A', NULL);
14+
15+
INSERT INTO
16+
Employee (id, name, department, managerId)
17+
VALUES
18+
('102', 'Dan', 'A', 101);
19+
20+
INSERT INTO
21+
Employee (id, name, department, managerId)
22+
VALUES
23+
('103', 'James', 'A', 101);
24+
25+
INSERT INTO
26+
Employee (id, name, department, managerId)
27+
VALUES
28+
('104', 'Amy', 'A', 101);
29+
30+
INSERT INTO
31+
Employee (id, name, department, managerId)
32+
VALUES
33+
('105', 'Anne', 'A', 101);
34+
35+
INSERT INTO
36+
Employee (id, name, department, managerId)
37+
VALUES
38+
('106', 'Ron', 'B', 101);
39+
40+
COMMIT;

Monthly Transactions/schema.sql

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
1-
Create table If Not Exists Transactions (id int, country varchar(4), state enum('approved', 'declined'), amount int, trans_date date)
2-
Truncate table Transactions
3-
insert into Transactions (id, country, state, amount, trans_date) values ('121', 'US', 'approved', '1000', '2018-12-18')
4-
insert into Transactions (id, country, state, amount, trans_date) values ('122', 'US', 'declined', '2000', '2018-12-19')
5-
insert into Transactions (id, country, state, amount, trans_date) values ('123', 'US', 'approved', '2000', '2019-01-01')
6-
insert into Transactions (id, country, state, amount, trans_date) values ('124', 'DE', 'approved', '2000', '2019-01-07')
1+
CREATE TABLE IF NOT EXISTS Transactions (
2+
id int,
3+
country varchar(4),
4+
state enum('approved', 'declined'),
5+
amount int,
6+
trans_date date
7+
);
8+
9+
TRUNCATE TABLE Transactions;
10+
11+
INSERT INTO
12+
Transactions (id, country, state, amount, trans_date)
13+
VALUES
14+
('121', 'US', 'approved', '1000', '2018-12-18');
15+
16+
INSERT INTO
17+
Transactions (id, country, state, amount, trans_date)
18+
VALUES
19+
('122', 'US', 'declined', '2000', '2018-12-19');
20+
21+
INSERT INTO
22+
Transactions (id, country, state, amount, trans_date)
23+
VALUES
24+
('123', 'US', 'approved', '2000', '2019-01-01');
25+
26+
INSERT INTO
27+
Transactions (id, country, state, amount, trans_date)
28+
VALUES
29+
('124', 'DE', 'approved', '2000', '2019-01-07');
30+
31+
COMMIT;
Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
1-
Create table If Not Exists Products (product_id int, new_price int, change_date date)
2-
Truncate table Products
3-
insert into Products (product_id, new_price, change_date) values ('1', '20', '2019-08-14')
4-
insert into Products (product_id, new_price, change_date) values ('2', '50', '2019-08-14')
5-
insert into Products (product_id, new_price, change_date) values ('1', '30', '2019-08-15')
6-
insert into Products (product_id, new_price, change_date) values ('1', '35', '2019-08-16')
7-
insert into Products (product_id, new_price, change_date) values ('2', '65', '2019-08-17')
8-
insert into Products (product_id, new_price, change_date) values ('3', '20', '2019-08-18')
1+
CREATE TABLE IF NOT EXISTS Products (product_id int, new_price int, change_date date);
2+
3+
TRUNCATE TABLE Products;
4+
5+
INSERT INTO
6+
Products (product_id, new_price, change_date)
7+
VALUES
8+
('1', '20', '2019-08-14');
9+
10+
INSERT INTO
11+
Products (product_id, new_price, change_date)
12+
VALUES
13+
('2', '50', '2019-08-14');
14+
15+
INSERT INTO
16+
Products (product_id, new_price, change_date)
17+
VALUES
18+
('1', '30', '2019-08-15');
19+
20+
INSERT INTO
21+
Products (product_id, new_price, change_date)
22+
VALUES
23+
('1', '35', '2019-08-16');
24+
25+
INSERT INTO
26+
Products (product_id, new_price, change_date)
27+
VALUES
28+
('2', '65', '2019-08-17');
29+
30+
INSERT INTO
31+
Products (product_id, new_price, change_date)
32+
VALUES
33+
('3', '20', '2019-08-18');
34+
35+
COMMIT;

0 commit comments

Comments
 (0)