Skip to content

лабораторная работа 4#9

Open
plidan123 wants to merge 1 commit intomainfrom
lab_4
Open

лабораторная работа 4#9
plidan123 wants to merge 1 commit intomainfrom
lab_4

Conversation

@plidan123
Copy link
Owner

No description provided.

@plidan123 plidan123 requested a review from misshimichka October 8, 2025 11:01
Copy link
Collaborator

@misshimichka misshimichka left a comment

Choose a reason for hiding this comment

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

Привет! По ЛР4:

Ставлю 10/13, нужно поправить задания с ошибками.

--а также общее количество заказов
select shipcountry,shipcity, count(distinct orderid)
from "Sales"."Orders" as o
group by rollup(shipcountry, shipcity)
Copy link
Collaborator

Choose a reason for hiding this comment

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

4.a. 0
Не выводится количество заказов по городам.

c.city,
o.shipcountry,
o.shipcity
order by sum(d.unitprice * d.qty*(1-d.discount));
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. 0
    Неверно вычисляется shipad
    Неверная конечная дата периода

FROM public."OrderValues" as o
WHERE orderdate BETWEEN '2007-01-01'::date AND '2007-12-31'::date
GROUP BY TO_CHAR(orderdate, 'Month'), EXTRACT(MONTH FROM orderdate)
ORDER BY EXTRACT(MONTH FROM orderdate);
Copy link
Collaborator

Choose a reason for hiding this comment

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

2.6. Не ошибка, а замечание: правильнее создать алиас для EXTRACT(MONTH FROM orderdate) и не вычислять каждый раз, а сортировать по алиасу.

dense_rank() over( order by count(orderid) desc, p.productname asc)
from "Production"."Products" as p
join "Sales"."OrderDetails" as d on p.productid = d.productid
group by p.productname,p.unitprice;
Copy link
Collaborator

Choose a reason for hiding this comment

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

2.3. Запрос не выводит товары, которые не входят ни в один заказ.

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