Skip to content

Commit 7a4870e

Browse files
corrected schema
1 parent b44b59e commit 7a4870e

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

Department Top 3 Salary/schema.sql

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1-
Create table If Not Exists Employee (id int, name varchar(255), salary int, departmentId int)
2-
Create table If Not Exists Department (id int, name varchar(255))
3-
Truncate table Employee
4-
insert into Employee (id, name, salary, departmentId) values ('1', 'Joe', '85000', '1')
5-
insert into Employee (id, name, salary, departmentId) values ('2', 'Henry', '80000', '2')
6-
insert into Employee (id, name, salary, departmentId) values ('3', 'Sam', '60000', '2')
7-
insert into Employee (id, name, salary, departmentId) values ('4', 'Max', '90000', '1')
8-
insert into Employee (id, name, salary, departmentId) values ('5', 'Janet', '69000', '1')
9-
insert into Employee (id, name, salary, departmentId) values ('6', 'Randy', '85000', '1')
10-
insert into Employee (id, name, salary, departmentId) values ('7', 'Will', '70000', '1')
11-
Truncate table Department
12-
insert into Department (id, name) values ('1', 'IT')
13-
insert into Department (id, name) values ('2', 'Sales')
1+
CREATE TABLE IF NOT EXISTS Employee (
2+
id int,
3+
name varchar(255),
4+
salary int,
5+
departmentId int
6+
);
7+
8+
CREATE TABLE IF NOT EXISTS Department (id int, name varchar(255));
9+
10+
TRUNCATE TABLE Employee;
11+
12+
INSERT INTO
13+
Employee (id, name, salary, departmentId)
14+
VALUES
15+
(1, 'Joe', 85000, 1),
16+
(2, 'Henry', 80000, 2),
17+
(3, 'Sam', 60000, 2),
18+
(4, 'Max', 90000, 1),
19+
(5, 'Janet', 69000, 1),
20+
(6, 'Randy', 85000, 1),
21+
(7, 'Will', 70000, 1);
22+
23+
TRUNCATE TABLE Department;
24+
25+
INSERT INTO
26+
Department (id, name)
27+
VALUES
28+
(1, 'IT'),
29+
(2, 'Sales');

0 commit comments

Comments
 (0)