-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
GROUP BY TO_CHAR((publication_date), 'Month') | ||
ORDER BY COUNT(*) DESC | ||
LIMIT 1 | ||
) AS month_with_max_resumes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
возможно, поиск месяца стоит переделать на селект с вложенным запросом (вложенным запросом найти максимальное количество вакансий / резюме, а внешним запросом отбирать по условию, что количество резюме в месяце равно максимальному) - это если требуется вывести все месяцы с наибольшим количеством вакансий / резюме при совпадении наибольшего количества в нескольких месяцах. в текущем варианте выведется один случайный месяц.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
здесь и далее: если поле не подразумевает длинного текста, то лучше использовать varchar
vacancy_specialization_id SERIAL PRIMARY KEY, | ||
vacancy_id INTEGER NOT NULL REFERENCES vacancy (vacancy_id), | ||
specialization_id INTEGER NOT NULL REFERENCES specialization (specialization_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
да, для таблицы откликов суррагатный ключ не нужен
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENUM 👍
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут тоже самое
можно сделать составной ключ из резюме_id, вакансия_id, или если привычнее с сурагатным, то хотя бы навесить констрейнт на пару значений, чтобы не было возможности десять раз откликаться на одну и ту же вакансию одним резюме
-- Функция для получения случайного значения из перечисления | ||
CREATE OR REPLACE FUNCTION random_enum(relation_name ANYELEMENT, OUT result ANYENUM) | ||
AS |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
так ок, но не учтен момент, что месяцы отличаются по годам, ноябрь 20 и ноябрь 21 года это разные месяцы
tasks 1 - 6 completed