Задание 3.

1 способ
1) select count(*) as 'всего: 0202' from gruz
where spec='0202'
2) select vuz.uch_zavedenie,count(*)
from gruz join vuz on vuz_k=vuz.cod
where spec in ('0202', '0203', '0205', '0206')
group by vuz.uch_zavedenie

2 способ
create procedure zapr6 as
select count(*) as 'всего: 0202' from gruz
where spec='0202'
select vuz.uch_zavedenie,count(*)
from gruz join vuz on vuz_k=vuz.cod
where spec in ('0202', '0203', '0205', '0206')
group by vuz.uch_zavedenie

3) select count(*) as 'всего: 0203' from gruz
where spec='0203'
4) select vuz.uch_zavedenie,count(*) as '0203'
from gruz,vuz
where spec='0203' and vuz_k=vuz.cod
group by vuz.uch_zavedenie


5) select count(*) as 'всего: 0205' from gruz
where spec='0205'
6) select vuz.uch_zavedenie,count(*) as '0205'
from gruz,vuz
where spec='0205' and vuz_k=vuz.cod
group by vuz.uch_zavedenie


7) select count(*) as 'всего: 0206' from gruz
where spec='0206'
8) select vuz.uch_zavedenie,count(*) as '0206'
from gruz,vuz
where spec='0206' and vuz_k=vuz.cod
group by vuz.uch_zavedenie


Задание 4.

1 способ
1) select count(*) from gruz
where pol='М'
2) select vuz.uch_zavedenie,count(*)
from gruz join vuz on vuz_k=vuz.cod
where pol='М'
group by vuz.uch_zavedenie

2 способ
create procedure zapr1 as
select count(*) from gruz where pol='М'
select vuz.uch_zavedenie,count(*)
from gruz join vuz on vuz_k=vuz.cod
where pol='М'
group by vuz.uch_zavedenie

Задание 5.

1способ
1) select count(*) from gruz
where kat_obuch_k='03'
and gok='94'
2) select spec, count(*) from gruz
where gok='94' and kat_obuch_k='03'
group by spec

2 способ

create procedure zapr2 as
select count(*) from gruz
where kat_obuch_k='03'
and gok='94'
select spec, count(*) from gruz
where gok='94' and kat_obuch_k='03'
group by spec

Задание 8.

1 способ

1) select count(*) from gruz
where gp='91'
2) select kat_obuch.kat_obucheniya, count(*)
from gruz join kat_obuch on kat_obuch_k=kat_obuch.cod
where gok='91'
group by kat_obuch.kat_obucheniya

2 способ
create procedure zapr3 as
select count(*) from gruz where gp='91'
select kat_obuch.kat_obucheniya, count(*)
from gruz join kat_obuch on kat_obuch_k=kat_obuch.cod
where gok='91'
group by kat_obuch.kat_obucheniya


Задание 11.

1 способ

1) select count(*) from gruz
where kat_obuch_k='03'
2) select vuz_gorod.nazvanie_goroda, count(*)
from gruz join vuz_gorod on vuz_k=vuz_gorod.cod_vuza
where kat_obuch_k='03'
group by vuz_gorod.nazvanie_goroda

2 способ
create procedure zapr4 as
select count(*) from gruz where kat_obuch_k='03'
select vuz_gorod.nazvanie_goroda, count(*)
from gruz join vuz_gorod on vuz_k=vuz_gorod.cod_vuza
where kat_obuch_k='03'
group by vuz_gorod.nazvanie_goroda








Чтобы не видеть здесь видео-рекламу достаточно стать зарегистрированным пользователем.
Чтобы не видеть никакую рекламу на сайте, нужно стать VIP-пользователем.
Это можно сделать совершенно бесплатно. Читайте подробности тут.