Обикновен морков: Разлика между версии

Изтрито е съдържание Добавено е съдържание
м десетична запетая за процент
Редакция без резюме
Етикети: Редакция чрез мобилно устройство Редакция чрез мобилно приложение
Ред 1:
{{Taxobox/* student name, student sport */
select `st`.`name` as `student`, `sp`.`name` as `sport`
| regnum = Plantae
from `students` `st`
join `sports` `sp` on `sp`.`id` in
(select `sport_id` from `sportgroups` `sg` where `sg`.`id` in
(select `sportGroup_id` from `student_sport` `stsp` where `stsp`.`student_id` = `st`.`id`));
 
/* location, sport name */
select `sg`.`location` as `location`, `sp`.`name` as `sport`
from `sportgroups` `sg`
join `sports` `sp` on `sp`.`id` = `sg`.`sport_id`;
 
/* sport names ? coach id 2 */
select `sp`.`name` as `sport`
from `sports` `sp`
where `sp`.`id` in (select `sport_id` from `sportgroups` `sg` where `sg`.`coach_id` = 2);
 
/* student name, student class, group id ? training day Sunday */
select `st`.`name` as `student`, `st`.`class` as `class`, `sg`.`id` as `sportgroup_id`
from `students` `st`
join `sportgroups` `sg` on `sg`.`id` in
(select `sportGroup_id` from `student_sport` `stsp` where `stsp`.`student_id` = `st`.`id`)
where `sg`.`dayOfWeek` = 'Sunday';
 
/* coach name ? sport Volleyball */
select `c`.`name` as `coach`
from `coaches` `c`
where `c`.`id` in
(select `coach_id` from `sportgroups` `sg` where `sg`.`sport_id` in
(select `id` from `sports` `sp` where `sp`.`name` = 'Volleyball'));
 
/* student pairs / same sport group [distinct] ? sport Football */
select distinct `st1`.`name` as `student1`, `st2`.`name` as `student2`
from `students` `st1`
join `students` `st2` on `st2`.`name` != `st1`.`name`
where `st1`.`id` in
(select `student_id` from `student_sport` `stsp` where `stsp`.`sportGroup_id` in
(select `id` from `sportgroups` `sg` where `sg`.`sport_id` = (select `id` from `sports` `sp` where `sp`.`name` = 'Football')))
and
`st2`.`id` in
(select `student_id` from `student_sport` `stsp` where `stsp`.`sportGroup_id` in
(select `id` from `sportgroups` `sg` where `sg`.`sport_id` = (select `id` from `sports` `sp` where `sp`.`name` = 'Football')))
and
`st1`.`id` in
(select `student_id` from `student_sport` `stsp` where `stsp`.`sportGroup_id` in (select `sportGroup_id` from `student_sport` where `student_id` = `st2`.`id`))
and
`st2`.`id` in
(select `student_id` from `student_sport` `stsp` where `stsp`.`sportGroup_id` in (select `sportGroup_id` from `student_sport` where `student_id` = `st1`.`id`));
 
/* student name, class, location, coach name ? training hour 8 */
select `st`.`name` as `student`, `st`.`class` as `class`, `sg`.`location` as `location`, `c`.`name` as `coach`
from `students` `st`
join `sportgroups` `sg` on `sg`.`id` in
(select `sportGroup_id` from `student_sport` `stsp` where `stsp`.`student_id` = `st`.`id`)
join `coaches` `c` on `c`.`id` = `sg`.`coach_id`
where `sg`.`hourOfTraining` = '8:00'; regnum = Plantae
| regnum-bg = [[Растения]]
| divisio = Magnoliophyta