select first_name, last_name,trunc(months_between(sysdate,hire_date)/12) "Ani de lucru" from employees
Fondul de salarii din fiecare departament dar doar pt angajatii mai vechi de 15 ani
select sum(salary) "Fond de salarii", department_name from employees e,departments d where e.department_id=d.department_id and trunc(months_between(sysdate,hire_date)/12)>15 group by department_name
Afiseaza doar departamentele in care lucraeza mai vechi de 15 ani cu fond de salarii de peste 15000
select sum(salary) "Fond de salarii", department_name from employees e,departments d where e.department_id=d.department_id and trunc(months_between(sysdate,hire_date)/12)>15 group by department_name having sum(salary)>15000
SELECT - coloane
FROM - tabele
WHERE - expresie logica
GROUP BY - coloan1, coloana 2
HAVING - expresie logica (conditie pe grupul definit)
ORDER - coloana1 (alias)
HAVING nu poate aparea fara GROUP BY
select sum(salary) "Fond de salarii", department_name from employees e,departments d where e.department_id=d.department_id and trunc(months_between(sysdate,hire_date)/12)>15 group by department_name having sum(salary)>=(select avg(salary) from employees)
select sum(salary) "Fond de salarii", department_name from employees e,departments d where e.department_id=d.department_id and trunc(months_between(sysdate,hire_date)/12)>1 group by department_name having count(*)>2
Orar semigroup #2
16 noiembrie
vineri, 16 noiembrie 2012
by DlMuresan
Categories:
ionescu,
Oracle
|
Leave a comment
Oracal v3 - 15 noiembrie
15 noiembrie
Suma salariilor din fiecare departament (CU GROUP BY)
select sum(salary), department_id from employees group by department_id
select sum(salary), department_id, first_name from employees group by department_id, first_name
Suma salariilor din fiecare departament (cu numele departamentului)
Sintaxa ANSI
select sum(salary), department_name from employees join departments using(department_id) group by department_name
Sintaxa Oracle
select sum(salary) "Fond de salarii", department_name from employees e,departments d where e.department_id=d.department_id group by department_name
(e si d - aliasurile tabelelor)
Self Joining (Angajati - Sefi)
ANSI: select e.first_name "angajat", m.first_name "sef" from employees e join employees m on(m.employee_id=e.manager_id)
select e.first_name "angajat", m.first_name "sef" from employees e join employees m on(m.employee_id=e.manager_id) where m.first_name='Steven' order by 2
ORACLE: select e.first_name, m.first_name from employees e, employees m where m.employee_id=e.manager_id order by 2
select e.first_name, m.first_name from employees e, employees m where m.employee_id=e.manager_id and m.first_name='Steven' order by 2
(2 - sef, 1 - angajat)
miercuri, 14 noiembrie 2012
by DlMuresan
Categories:
eugen,
ionescu,
Oracle
|
Leave a comment
Subiecte BAC Romana 2009 - rezolvate
marți, 13 noiembrie 2012
by DlMuresan
Categories:
BAC,
romana,
vigul
|
Leave a comment
DAS KOMPTON iEffect
https://www.google.ro/#hl=ro&output=search&sclient=psy-ab&q=efectul+compton&oq=efectul+compton&gs_l=hp.3..0l2j0i30l2.27556.29650.0.29798.15.8.0.7.7.0.194.958.4j4.8.0...0.0...1c.1.zChZAxqO_bg&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&fp=802f54e5ac7e48b5&bpcl=38093640&biw=1680&bih=920
http://ro.wikipedia.org/wiki/%C3%8Empr%C4%83%C8%99tiere_Compton
https://www.google.ro/search?q=efectul+compton&hl=ro&prmd=imvns&tbm=isch&tbo=u&source=univ&sa=X&ei=EtufUJXcMIi0tAa3o4DQBA&ved=0CCIQsAQ&biw=1680&bih=920
http://dexonline.ro/definitie/parafin%C4%83
http://www.scientia.ro/fizica/50-mecanica-cuantica/292-efectul-compton.html
http://www.referate-online.org/referate/fizica/Referat_Fizica_Efectul_Compton.html
CHROME
http://ro.scribd.com/doc/42948727/Efectul-Compton
http://www.physics.pub.ro/Cursuri/Carmen_Liliana_Schiopu_-_Fizica_Atomica_(Note_de_Curs)/1.3_Efectul_COMPTON.pdf
http://www.thegame.go.ro/Referate/Efectul%20Compton.htm
duminică, 11 noiembrie 2012
by DlMuresan
Categories:
compton,
fizica
|
Leave a comment
Oracal v.2 - de pe Academy therory
Functie de inserare rand (instanta) intr-un tabel
(Sectiunea 12, Lectia 1, Slide 7)
insert into <table name> values (value1, value2, ...)
Value reprezinta atributele din coloanele existente (poate fi si null)
Adaugarea unei coloane noi la un tabel
S 12, L 2
alter table <table name> add (<column_name> <data type>)
Column name fara ' '
Stergerea unei coloane
alter table <table name> drop column <column name>
Stergerea unui rand
Delete from <table name> where <column name> = ' some value '
Proiectie - alegerea a uneia sau mai multor coloane
Selectie - alegerea a unuia sau mai multor randuri
select distinct department_id from employees - afiseaza valorile distincte din coloana department_id
select commission_pct, first_name from employees order by commission_pct - ordonare dupa comision
order apare ultimul in interogare
order by salary DESC - ordoneaza descrescator
fara DESC - ordoneaza crescator
In WHERE nu se pot pune alias-uri. Se pot pune decat in ORDER
select first_name, last_name, department_name
from employees e, departments d
where e.department_id (+)=d.department_id
order by department_name, first_name
cu (+) dupa coloana din where care e nula pt a o afisa, afiseaza si departamentul fara nume
Nu merge (+) la mai multe coloane pt oracle
Afiseaza direct numele departamentului pt fiecare angajat (in loc de id-ul departamentului)
Varianta ANSI pt acelasi lucru
select first_name, last_name, department_name from employees full outer join departments
using (department_id)
Cu left outer inainte de joi, afiseaza ce lipseste din stanga. Cu right outer, din dreapta.
Echivalentul (+) in ambele coloane este FULL OUTER JOIN
select department_name, count (department_id)
from employees join departments
using (department_id)
group by department_name
Numara cati angajati sunt in fiecare departament. Daca se aduna, rezulta angajatii in total.
miercuri, 7 noiembrie 2012
by DlMuresan
Categories:
ionescu,
Oracle,
radu banciu
|
1 comment