Professional Documents
Culture Documents
--2
rename persoane to angajati;
--3
alter table angajati add (salariu number(4));
--4
alter table angajati add constraint VerificaSalariu check( salariu >1000 and salariu<5000);
--5
alter table facultati modify denfac varchar2(70);
--6
alter table angajati disable constraint VerificaSalariu;
--7
insert into facultati
values('CSIE','Cibernetica Statistica si Informatica Economica');
insert into facultati
values('CIG','Contabilitate si Informatica de Gestiune');
insert into facultati
values('COM','Comert');
--8
update angajati set nume='Marinescu' where codp=3;
--9
update angajati set functia='Lect' where codp=4;
--10
update angajati set salariu=salariu+0.1*salariu where salariu<1400;
--11
update angajati set codcat=(select codcat from angajati where codp=2) where codp=4;
--12
select* from facultati;
--13
--14
select nume,functia
from angajati
order by nume desc;
--15
select* from angajati
where upper(nume) like 'S%';
--16
select* from angajati
where rownum<4 and dataang is not null
order by dataang;
--17
select nume, salariu, functia ,
case functia
when 'Prep' then salariu+200
when 'Asist' then salariu+200
when 'Lect' then salariu+170
else salariu+150
end
as salariu_majorat
from angajati;
--18
select nume from angajati
where functia in('Asist','Lect');
--19
select max(salariu),min(salariu),avg(salariu)
from angajati
where extract(year from dataang)>2000;
--20
create table Departamente as(select* from Catedre where 1=2);
--21
select count(codp) as"Numar persoane"
from angajati
where codcat='IE';
--22
select* from angajati
where functia in('Prof','Conf') and salariu>2000;
--23
select c.dencat, avg(a.salariu)
from catedre c,angajati a
where c.codcat=a.codcat
group by c.dencat;
--24
select functia, avg(salariu) as "Salariul mediu"
from angajati
group by functia
having avg(salariu)>1200;
--25
select * from angajati
where codcat=(select codcat from angajati where nume='Ionescu');
--26
select * from angajati
where salariu>(select avg(salariu) from angajati);
--27
update angajati
set salariu=salariu+100 where codcat='IE';
--28
select c.dencat, count(a.codp)as "Numar persoane"
from angajati a,catedre c
where a.codcat=c.codcat and c.dencat!='Informatica economica'
group by c.dencat
having count(codp)>1;
--29
select functia,count(codp) as "Numar persoane"
from angajati
group by functia;
--30
delete from angajati
where codp=2;