Está en la página 1de 1

if object_id('alumnos') is not null drop table alumnos; create table alumnos( documento char(8), nombre varchar(30), nota decimal(4,2),

primary key(documento), constraint CK_alumnos_nota_valores check (nota between 0 and 10), ); insert insert insert insert insert insert into into into into into into alumnos alumnos alumnos alumnos alumnos alumnos values('30111111','Ana Algarbe',5.1); values('30222222','Bernardo Bustamante',3.2); values('30333333','Carolina Conte',4.5); values('30444444','Diana Dominguez',9.7); values('30555555','Fabian Fuentes',8.5); values('30666666','Gaston Gonzalez',9.70);

select a.documento, a.nombre, a.nota from alumnos as a where a.nota = (select MAX(nota) from alumnos); select titulo,autor, precio from libros where precio= (select titulo, max(precio) from libros); select a.documento, a.nombre, a.nota, (select AVG(nota) from alumnos)-a.nota as diferencia from alumnos as a where nota<(select AVG(nota) from alumnos); update alumnos set nota=4 where nota = (select MIN(nota) from alumnos); select * from alumnos; delete from alumnos where nota<(select AVG(nota) from alumnos); select * from alumnos;

También podría gustarte