Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

--2 elevii cu numar maxim de absente din 12a.

Sau mesaj corespunzator select * from elevi1 where Absente=(select MAX(Absente) from elevi1 where Clasa='12a') if @@ROWCOUNT=0 --returneaza numarul de inregistrari afectate de comanda de mai sus(Select). print 'nu exista clasa 12a' --3 numarul absentelor la nivel de scoala select SUM(absente) as Total_Absente from elevi1 --2 if exists(select * from elevi2 where clasa='12b') select * from elevi2 where clasa='12b' and absente>10 else print 'nu exista' --3 delete from elevi2 where absente=0 select * from elevi2 --2 select clasa from scoala where nume='Ionescu Dan' --3 select * from scoala where clasa=(select clasa from scoala where nume='Ionescu Dan') and nume!='Ionescu Dan' --2 if exists(select * from scoala2 where varsta>18) select * from scoala2 where varsta>18 else print 'nu exista' --3 select * from scoala2 order by varsta desc --2 select * from examen update examen set media=(nota1+nota2)/2 where nota1>=5 and nota2>=5 --3 if exists(select * from examen where media>=5) select * from examen where media>=5 order by nume else print 'Nici un reusit la examen' --2 select (nota1+nota2)/2 as media from examen2 --3 if exists(select * from examen2 where (nota1+nota2)/2>=5) select * from examen2 where (nota1+nota2)/2>=5 order by nume else print 'Nici un reusit la examen' --2 if exists(select * from produse where cantitate=0) delete from produse where cantitate=0 else print ' Nu avem produse cu stocul 0'

You might also like