Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added solution #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

added solution #1

wants to merge 1 commit into from

Conversation

dmitrynoskov
Copy link
Owner

@dmitrynoskov dmitrynoskov commented Jan 24, 2022

tasks 1 - 6 completed

GROUP BY TO_CHAR((publication_date), 'Month')
ORDER BY COUNT(*) DESC
LIMIT 1
) AS month_with_max_resumes;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

возможно, поиск месяца стоит переделать на селект с вложенным запросом (вложенным запросом найти максимальное количество вакансий / резюме, а внешним запросом отбирать по условию, что количество резюме в месяце равно максимальному) - это если требуется вывести все месяцы с наибольшим количеством вакансий / резюме при совпадении наибольшего количества в нескольких месяцах. в текущем варианте выведется один случайный месяц.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

так ок, но не учтен момент, что месяцы отличаются по годам, ноябрь 20 и ноябрь 21 года это разные месяцы

CREATE TABLE IF NOT EXISTS area
(
area_id SERIAL PRIMARY KEY,
area_name TEXT NOT NULL

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

здесь и далее: если поле не подразумевает длинного текста, то лучше использовать varchar

Comment on lines +51 to +53
vacancy_specialization_id SERIAL PRIMARY KEY,
vacancy_id INTEGER NOT NULL REFERENCES vacancy (vacancy_id),
specialization_id INTEGER NOT NULL REFERENCES specialization (specialization_id)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, для таблицы откликов суррагатный ключ не нужен

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

уникальность на пару значений бы навесить еще

);

DROP TYPE IF EXISTS gender CASCADE;
CREATE TYPE gender AS ENUM ('Male', 'Female');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENUM 👍

Comment on lines +105 to +110
respond_id SERIAL PRIMARY KEY,
vacancy_id INTEGER NOT NULL REFERENCES vacancy (vacancy_id),
resume_id INTEGER NOT NULL REFERENCES resume (resume_id),
cover_letter TEXT,
respond_date DATE NOT NULL DEFAULT NOW(),
respond_status respond_status DEFAULT 'Not viewed'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут тоже самое
можно сделать составной ключ из резюме_id, вакансия_id, или если привычнее с сурагатным, то хотя бы навесить констрейнт на пару значений, чтобы не было возможности десять раз откликаться на одну и ту же вакансию одним резюме

Comment on lines +34 to +36
-- Функция для получения случайного значения из перечисления
CREATE OR REPLACE FUNCTION random_enum(relation_name ANYELEMENT, OUT result ANYENUM)
AS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

GROUP BY TO_CHAR((publication_date), 'Month')
ORDER BY COUNT(*) DESC
LIMIT 1
) AS month_with_max_resumes;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

так ок, но не учтен момент, что месяцы отличаются по годам, ноябрь 20 и ноябрь 21 года это разные месяцы

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants