最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

database_leetcode 2004. The Number of Seniors and Juniors to Joi

2022-02-22 14:02 作者:您是打尖兒還是住店呢  | 我要投稿

Table: Candidates


+-------------+------+

| Column Name | Type |

+-------------+------+

| employee_id | int ?|

| experience ?| enum |

| salary ? ? ?| int ?|

+-------------+------+

employee_id is the primary key column for this table.

experience is an enum with one of the values ('Senior', 'Junior').

Each row of this table indicates the id of a candidate, their monthly salary, and their experience.

A company wants to hire new employees. The budget of the company for the salaries is $70000. The company's criteria for hiring are:


Hiring the largest number of seniors.

After hiring the maximum number of seniors, use the remaining budget to hire the largest number of juniors.

Write an SQL query to find the number of seniors and juniors hired under the mentioned criteria.


Return the result table in any order.


Candidates table:

+-------------+------------+--------+

| employee_id | experience | salary |

+-------------+------------+--------+

| 1 ? ? ? ? ? | Junior ? ? | 10000 ?|

| 9 ? ? ? ? ? | Junior ? ? | 10000 ?|

| 2 ? ? ? ? ? | Senior ? ? | 80000 ?|

| 11 ? ? ? ? ?| Senior ? ? | 80000 ?|

| 13 ? ? ? ? ?| Senior ? ? | 80000 ?|

| 4 ? ? ? ? ? | Junior ? ? | 40000 ?|

+-------------+------------+--------+

Output:

+------------+---------------------+

| experience | accepted_candidates |

+------------+---------------------+

| Senior ? ? | 0 ? ? ? ? ? ? ? ? ? |

| Junior ? ? | 3 ? ? ? ? ? ? ? ? ? |

+------------+---------------------+

Explanation:

We cannot hire any seniors with the current budget as we need at least $80000 to hire one senior.

We can hire all three juniors with the remaining budget.

其實(shí)關(guān)鍵就是最后一句話;

database_leetcode 2004. The Number of Seniors and Juniors to Joi的評論 (共 條)

分享到微博請遵守國家法律
乌海市| 高尔夫| 鄂尔多斯市| 墨竹工卡县| 壶关县| 丹东市| 印江| 黄大仙区| 云阳县| 嘉义县| 海南省| 恩施市| 平江县| 隆林| 浮梁县| 弥勒县| 镇康县| 鄂托克前旗| 耿马| 金华市| 昌乐县| 甘谷县| 古蔺县| 博爱县| 新乡市| 宜阳县| 阿坝| 昌都县| 交城县| 方正县| 噶尔县| 万州区| 栖霞市| 金秀| 杭州市| 牙克石市| 屏东市| 溧阳市| 舞阳县| 宜君县| 新化县|