25 select codicecorso, matricolastudente, voto from esame join studente on matricolastudente=matricola where città = milano select matricola, cognome, nome from studente join esame on matricola=matricolastudente join corso on codicecorso=codice group by matricola, cognome, nome having sum(numerocrediti)>=20 "> 25 select codicecorso, matricolastudente, voto from esame join studente on matricolastudente=matricola where città = milano select matricola, cognome, nome from studente join esame on matricola=matricolastudente join corso on codicecorso=codice group by matricola, cognome, nome having sum(numerocrediti)>=20 "> 25 select codicecorso, matricolastudente, voto from esame join studente on matricolastudente=matricola where città = milano select matricola, cognome, nome from studente join esame on matricola=matricolastudente join corso on codicecorso=codice group by matricola, cognome, nome having sum(numerocrediti)>=20 ">
select count(*)
from insegnante
where stipendio < 2000
select count distinct città
from insegnante
select max(stipendio)
from insegnante
where nome like "M_m%"
select avg(stipendio)
from insegnante
where città = Milano or città = como
select matricola, avg(voto), count(esami)
from esame
group bz matricolastudente
select matricolastudente, avg(voto),
from esame
group by matricolastudente
having avg(voto)>25
select codicecorso, matricolastudente, voto
from esame join studente on matricolastudente=matricola
where città = milano
select matricola, cognome, nome
from studente join esame on matricola=matricolastudente join corso on codicecorso=codice
group by matricola, cognome, nome
having sum(numerocrediti)>=20
select matricolastudente
from esame
where voto=33
intersect
select matricolastudente
from esame
where voto =30
select nome, cognome
from studente
union
select nome, cognome
from insegnante
select cognome
from insegnante
except
select cognome
from studente
where città = milano
select codice, nome
from corso
where numerocrediti>all( select numero crediti, from corso)
select codice, nome
from corso
where numerocrediti > ant (select numerocrediti from corso)
select matricola, nome, cognome
from studente join esame on matricola = matricolastudente
where voto = 30
except
select matricolastudente
from esame
where voto<24
select *
from studente left join esame
select e1.matricolastudente
from esame as e1
where e1voto = 33
group by e1.matricolastudente
having count (*) >
(select count(*)
from esame as e2
where e1.matricolastudente0 e2.matricolastudente
)
select matricola, nome, cognome
from studente join esame
gruop by matricola, nome, cognome
having count(*) = (
select count(*)
from corso )
create view mediastudente(matricola, media)(
select matricolastudente, avg(voto)
from esame)
select media
from mediastudente
select avg(voto), matricola
from esame
group by matricola
having avg(voto)>avg(media)
create table studente(
char (6) matricola,
char (16) codicefiscale not null unique,
data datanascita not null check (data>=1/1/1900),
varchar(255) città,
boolean rappresentante not null default = false,
)
create table corso (
char(6) codice,
char nome not null,
)
create table esame(
char(6) codicecorso references corso(codice)
on update cascade, on delete no action,
char(6) matricolastudente references studente(matricola)
on update cascade, on delete no action,
int voto not not null check (voto between 18 and 31)
primary key (codicecorso, matricolastudente)
)
create assertion verificadata check(
not exists(
select *
from frequenza join corso
where