Files
ITMO/DB/DBLab2/task4.sql
T

11 lines
389 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
SELECT ГРУППА FROM
(
SELECT ГРУППА, COUNT(ГРУППА) FROM Н_УЧЕНИКИ
JOIN Н_ПЛАНЫ ON Н_УЧЕНИКИ.ПЛАН_ИД = Н_ПЛАНЫ.ИД
JOIN Н_ОТДЕЛЫ ON Н_ОТДЕЛЫ.ИД = Н_ПЛАНЫ.ОТД_ИД
WHERE Н_ОТДЕЛЫ.КОРОТКОЕ_ИМЯ = 'КТиУ'
AND EXTRACT(YEAR FROM НАЧАЛО) = 2011
GROUP BY ГРУППА
)
WHERE count = 5;