-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds sql code for specific role query w dept join
- Loading branch information
Showing
7 changed files
with
71 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
.env | ||
notes.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- query for getting all job roles with department name shown through a join | ||
select | ||
role.title as job_title, | ||
department.name as department | ||
from role | ||
join department on | ||
role.department_id = department.id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
-- insert into department (name) | ||
-- values ("logistics"), | ||
-- ("human resources"), | ||
-- ("sales"), | ||
-- ("accounting"); | ||
insert into department (name) | ||
values ("logistics"), | ||
("human resources"), | ||
("sales"), | ||
("accounting"); | ||
|
||
insert into role | ||
(title,salary,department_id) | ||
values ("swiper", 69420, 1), | ||
("assistant to the regional manager", 43100, 3), | ||
("pencil pusher", 175000, 2); | ||
|
||
insert into employee | ||
(first_name, last_name, role_id, manager_id) | ||
values | ||
("baba", "booey", 1, 2), | ||
("dwight","schrute", 2, 2); | ||
|
||
insert into employee | ||
(first_name, last_name, role_id) | ||
values | ||
("slithy", "tove", 3); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
view all departments, | ||
view all roles, | ||
mysql> source query.sql | ||
+-----------------------------------+-----------------+ | ||
| job_title | department | | ||
+-----------------------------------+-----------------+ | ||
| swiper | logistics | | ||
| assistant to the regional manager | sales | | ||
| pencil pusher | human resources | | ||
+---------------------------------- | ||
view all employees, | ||
add a department, | ||
add a role, | ||
add an employee, | ||
and update an employee role | ||
and update an employee role | ||
|
||
|
||
try to add some additional functionality to your application, such as the ability to do the following: | ||
|
||
Update employee managers. | ||
|
||
View employees by manager. | ||
|
||
View employees by department. | ||
|
||
Delete departments, roles, and employees. | ||
|
||
View the total utilized budget of a department—in other words, the combined salaries of all employees in that department. |