This file contains hidden or 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
select p.project_name, w.worker_name | |
from project p, worker w, project_worker_map m | |
where m.project_id = p.id | |
and m.worker_id = w.id |
This file contains hidden or 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
select max(compensation) as Max | |
from worker | |
select min(compensation) as Min | |
from worker |
This file contains hidden or 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
select project_worker_map.project_id, sum(worker.compensation) | |
from worker, project_worker_map | |
where worker = project_worker_map.worker_id | |
group by project_id | |
having sum(worker.compensation) > 500000 |
This file contains hidden or 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
select p.project_id, sum(w.compensation) as TotalComp | |
from worker w, project_worker_map p | |
where = p.worker_id | |
group by project_id | |
having sum(w.compensation) > 500000 |
This file contains hidden or 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
select p.project_id, sum(w.compensation) as TotalComp | |
from worker w, project_worker_map p | |
where = p.worker_id | |
group by project_id |
This file contains hidden or 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
select some_field | |
from some_table | |
group by some_field | |
having count(some_field) > 1 |
This file contains hidden or 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
select project_id, count(worker_id) as Worker_Count | |
from project_worker_map | |
group by project_id | |
having count(worker_id) > 2 |
This file contains hidden or 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
select project_id, count(worker_id) as WorkerCount | |
from project_worker_map | |
group by project_id |
This file contains hidden or 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
update worker | |
set compensation = 200000, | |
worker_code = 'CODE-X' | |
where id = 3 |
This file contains hidden or 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
INSERT INTO WORKER(ID, AUDIT_ID, WORKER_CODE, WORKER_NAME, COMPENSATION) | |
VALUES(1, '00000000-0000-0000-0000-000000000001', 'CODE-1', 'One First', 120000.00); |