0% found this document useful (0 votes)
20 views1 page

Sem 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Sem 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

--LDD: CREARE, ALTER, DROP

--actioneaza asupra obiectelor(tabele, useri, functii)

describe agenti_paza;
commit;
select * from firme;
select * from agenti_paza;
--Limbajul pentru manipularea datelor
--INSERT , UPDATE, DELETE, MERGE, SELECT

-- INSERT adauga inregistrati intr o tabela

--DELETE stergem inregistrari

insert into agenti_paza values (1,'Popescu', 'Ion',


to_date('15.07.2000','dd.mm.yyyy'),'M','1234567890123',80,1.98,'Liceu');
insert into agenti_paza (id_agent, nume, prenume, cnp) values(5,'Ionescu',
'Vasile', '1231');
insert into agenti_paza(id_agent, nume, prenume, cnp)
values(&id,'&nume','&prenume','&cnp');

create table agenti as select * from agenti_paza where 1=2;

select * from agenti;

insert into agenti select * from agenti_paza where nume = 'Popescu';

--UPDATE actualizam valori

update agenti_paza set data_nastere = to_date('15/10/2000','dd/mm/yyyy') where


id_agent = 2;

commit;

delete from agenti_paza;


rollback;
commit;

create table salariati as select * from angajati where 2=3;


select * from salariati;
select * from angajati;
insert into salariati select * from angajati where id_departament in (20,30);

select count(*) from salariati;


select count (*) from angajati;

MERGE INTO salariati USING angajati


ON (salariati.id_angajat = angajati.id_angajat)
WHEN MATCHED THEN
UPDATE SET salariati.salariul=angajati.salariul
WHEN NOT MATCHED THEN
INSERT (id_angajat, nume, salariul) VALUES (angajati.id_angajat, angajati.nume,
angajati.salariul);

You might also like