Skip to content

Commit

Permalink
Add unfinished code
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Dec 14, 2024
1 parent cab8c84 commit 9305f7c
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 0 deletions.
5 changes: 5 additions & 0 deletions solutions/beecrowd/2994/2994.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT doctor.name, ( ( 1 * 150 ) + 1 ) + ( ( 2 * 150 ) + 15 ) FROM attendances
JOIN doctors ON doctors.id = attendances.id_doctor
JOIN work_shifts ON work_shifts.id = attendances.id_work_shift
GROUP BY attendances.id
ORDER BY doctors.name;
Empty file added solutions/beecrowd/2994/WRONG
Empty file.
3 changes: 3 additions & 0 deletions solutions/beecrowd/2994/drop-table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP TABLE attendances;
DROP TABLE work_shifts;
DROP TABLE doctors;
Empty file added solutions/beecrowd/2994/out.txt
Empty file.
11 changes: 11 additions & 0 deletions solutions/beecrowd/2994/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
https://judge.beecrowd.com/en/problems/view/2994

# How much does a Doctor earn?

You work in the IT sector for a hospital and need to calculate the payment
revenue from each of the doctors. Each doctor earns 150$ per hour plus a
percentage that depends on the work shift. For example, the doctor Wellington
worked 1 hour in the day shift, and 2 hours in the night shift, therefore his
weekly salary will be: ( ( 1 * 150 ) + 1% ) + ( ( 2 * 150 ) + 15% ) = 496.5.
Furthermore, you can use the function ROUND(value,1) to show the salary with 1
decimal place e order the result from the highest to lowest salary.
57 changes: 57 additions & 0 deletions solutions/beecrowd/2994/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
--- URI Online Judge SQL
--- Copyright URI Online Judge
--- www.urionlinejudge.com.br
--- Problem 2994

CREATE TABLE doctors (
id integer PRIMARY KEY,
name varchar(50)
);

GRANT SELECT ON doctors TO sql_user;

CREATE TABLE work_shifts (
id integer PRIMARY KEY,
name varchar(50),
bonus numeric
);

GRANT SELECT ON work_shifts TO sql_user;

CREATE TABLE attendances (
id integer PRIMARY KEY,
id_doctor integer,
hours integer,
id_work_shift integer,
FOREIGN KEY (id_doctor) REFERENCES doctors(id),
FOREIGN KEY (id_work_shift) REFERENCES work_shifts(id)
);

GRANT SELECT ON attendances TO sql_user;

insert into doctors (id,name) values
(1,'Arlino'),
(2,'Tiago'),
(3,'Amanda'),
(4,'Wellington');

insert into work_shifts (id,name,bonus) values
(1,'nocturnal',15),
(2,'afternoon',2),
(3,'day',1);

insert into attendances (id, id_doctor, hours, id_work_shift) values
(1,1,5,1),
(2,3,2,1),
(3,3,3,2),
(4,2,2,3),
(5,1,5,3),
(6,4,1,3),
(7,4,2,1),
(8,3,2,2),
(9,2,4,2);

/* Execute this query to drop the tables */
-- DROP TABLE attendances;
-- DROP TABLE work_shifts;
-- DROP TABLE doctors;
1 change: 1 addition & 0 deletions solutions/beecrowd/2994/tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sql

0 comments on commit 9305f7c

Please sign in to comment.