REZOLVARI SUBIECTE ORACLE – ATESTAT 2008 4.1.
select cd_number as "Numar CD",title as"Titlu CD", producer as "Producator", year as "Anul aparitiei" from D_CDs where mod(length(title),2)<>0 order by year desc 4.2. select title,producer from d_cds where year in (select min(year) from d_cds) 4.3. select title,artist from d_songs where id in (select song_id from d_track_listings where track=1) 4.4. select c.title, s.title, s.artist from d_cds c join d_track_listings t on (c.cd_number=t.cd_number) join d_songs s on (t.song_id=s.id) where c.year =2000 5.1. select loc_type as "Tip locatie",address as "Adresa",comments as "Observatii" from d_venues where ID between 100 and 999 and address like '%o%' 5.2. select * from d_venues where length(comments)=(select max(length(comments)) from d_venues) 5.3. select count(*) from d_events where id not in(select id from d_venues where loc_type like '%Private%') 5.4. select e.name,e.cost,v.address from d_events e join d_venues v on (e.venue_id=v.id) where v.loc_type='Private Home' 6.1. select last_name||' '||first_name as "Nume si Prenume",phone as "Numar telefon", email as "Adresa de email" from d_clients where email like '%yahoo%' 6.2. select first_name,last_name from d_partners where id=(select id from d_partners where partner_type='Manager') 6.3. select name,event_date from d_events where client_number=(select client_number from d_clients where first_name='Lauren') 6.4. select s.title,s.artist,t.description from d_songs s join d_types t on (s.type_code=t.code) where s.title like 'I%' 7.1. select round(avg(salary)) as “Salariu mediu” from f_staffs where manager_id is not null 7.2. select code,name from f_promotional_menus where end_date-start_date=(select min(end_date-start_date) from f_promotional_menus) 7.3. select quantity from f_order_lines where food_item_number in (select food_item_number from f_food_items where regular_code is not null) 7.4. select c.first_name,c.last_name,o.order_date,o.order_total from f_customers c left outer join f_orders o on(c.id=o.cust_id) 8.1. select phone_number,email from employees where commission_pct is not null and substr(first_name,1,1) IN ('A','E','I','O','U') 8.2. select first_name,last_name from employees where hire_date=(select max(hire_date) from employees where department_id=50) 8.3. select count(*)as "numar angajati",trunc(avg(salary*(1+commission_pct)/100),3)as "salariu mediu" from employees where department_id in (select department_id from departments where department_name='Sales') 8.4. select employee_id,first_name,last_name,sum(end_date-start_date)as "numar zile" from job_history join employees using(employee_id) group by employee_id,first_name,last_name 9.1. select street_address as "Adresa",postal_code as "Cod postal",city as "Nume oras" from locations where country_id='US' and city like '%e' 9.2. select count(*) as "numar locatii" from locations where country_id not in (select country_id from locations where city='Seattle') 9.3. select country_id,country_name from countries where region_id in(select region_id from regions where region_name='Europe') 9.4. select department_name,street_address from departments join locations using(location_id) 10.1. select department_id,department_name from departments where upper(substr(department_name,1,1))=upper(substr(department_name,-1)) 10.2. select first_name,last_name from employees 1
where commission_pct in(select max(commission_pct) from employees where commission_pct is not null) 10.3. select department_name,department_id from departments where department_id not in(select department_id from employees where department_id is not null) 10.4. select first_name,last_name,salary,department_name from employees join departments using(department_id) where salary between 10000 and 15000 11.1. select lower('Atestat')||' '||upper('Oracle')||' '||lower(substr('Subiecte',1,7))||upper(substr('Subiecte',8,1)) from dual 11.2. select first_name,last_name,birthdate from f_staffs where manager_id=19 and salary<50 and birthdate between to_date('30-01-1969','DD-MM-YYYY') and to_date('31-12-1979','DD-MM-YYYY') 11.3. select salary,salary*1.03 as "salariu indexat" from f_staffs where first_name='Bob' 12.1. select 'Astazi '||to_char(sysdate,'DD-MON-YY')||' plec la munte!!!' from dual 12.2. select e.first_name||' '||e.last_name||' '||e.hire_date as "Angajat", m.first_name||' '||m.last_name||' '||m.hire_date as "Manager" from employees e,employees m where e.manager_id=m.employee_id and e.hire_date<m.hire_date 12.3. select department_id,round(avg(salary),3)from employees group by department_id 13.1. select substr('Informatica',2,3) from dual 13.2. select artist,title,duration from d_songs where title like '%r' 13.3. select s.artist,s.title,p.comments from d_songs s,d_play_list_items p where s.id=p.song_id order by s.artist 14.1. select replace('Astazi sustinem atestatul profesional',' ','*') from dual 14.2. select first_name,last_name from d_clients where client_number in(select client_number from d_events where substr(to_char(event_date,'DD-MM-YYYY'),4,2)='04') 14.3. select first_name,last_name,phone from d_clients where email like'%yahoo.com' 15.1. select replace ('afara ploua','a','') from dual 15.2. select * from f_promotional_menus order by start_date desc 15.3. - insert into f_customers values(1,'Prenume','Nume','Adresa','Oras','Tara','1','1') - select * from f_customers 16.1. select first_name,last_name from employees where mod(salary,3)=0 16.2. select first_name,last_name,trunc(salary*1.0420,2)as"Salariu indexat" from employees where department_id=80 16.3. select first_name,last_name,salary from employees where department_id in(select department_id from departments where location_id=1700) 17.1. select department_id from employees group by department_id having avg(salary)>(select avg(salary) from employees where department_id=60) 17.2. - insert into employees values(90,'Alin','Popescu','oracle',0744123456,to_date('30-01-2008','DD-MMYYYY'),'AD_VP',12000,null,101,90) - select * from employees 17.3. select e.first_name,e.last_name,d.department_id,d.department_name from employees e left outer join departments d on (e.department_id=d.department_id) 18.1. select j.job_title,h.start_date,h.end_date from jobs j,job_history h where j.job_id=h.job_id and min_salary between 2000 and 10000 18.2. select count(job_id) from jobs where (min_salary between 3000 and 20000) and (max_salary between 3000 and 200000) 18.3. select department_id,max(end_date-start_date) from job_history group by department_id 19.1. select artist,title from d_songs where artist like '%o%' 19.2. select title from d_songs where type_code in (12,77) order by title 2
19.3. select artist,title,duration,description from d_songs,d_types where type_code=code 20.1. select first_name,last_name,salary*1.25 from employees where department_id in(50,90,110) and hire_date>to_date('07-06-1994','DD-MM-YYYY') 20.2. select first_name,salary*1.33 from employees where department_id=50 and first_name like '%e%' 20.3. select first_name,last_name from employees where salary=(select max(salary) from employees) 21.1. select 'Mai sunt aproximativ '||trunc(months_between(to_date('25-12-2008','DD-MMYYYY'),sysdate))||' luni pana la Craciun' from dual 21.2. - create table copy_employees as select * from employees - select first_name,last_name,salary,department_id from copy_employees where salary between 10000 and 20000 21.3. select first_name,last_name,salary*1.1 from copy_employees order by 3 21.4. - alter table copy_employees add adresa varchar2(50) - alter table copy_employees drop column hire_date - alter table copy_employees drop column commission_pct - select * from copy_employees order by last_name 22.1. select 'Peste 10 luni vom fi in data de '||add_months(sysdate,10) from dual 22.2. create table copy_d_cds as select * from d_cds 22.3. select title,producer from copy_d_cds where year>=2000 22.4. - insert into copy_d_cds values(99,'Morandi Nrxt','Universal Music',2006) - select * from copy_d_cds order by title 23.1. select concat('Prima zi a lunii urmatoare este ',last_day(sysdate)+1) from dual 23.2. create table copy1_employees as select first_name,last_name,hire_date from employees select * from copy1_employees order by last_name 23.3. select first_name from copy1_employees where first_name like '%a%' 23.4. select min(salary),max(salary),trunc(avg(salary),3) from employees 24.1. select concat('In acest an luna februarie are ',last_day(to_date('01-02-2008','DD-MM-YYYY'))+1to_date('01-02-2008','DD-MM-YYYY'))||' zile' from dual 24.2. - create table copy_d_songs as select * from d_songs - select * from copy_d_songs order by artist 24.3. select title from copy_d_songs where duration>'5' 24.4. - insert into copy_d_songs values(51,'Right Here Waiting','6 min','Richard Marx',60) - select id,title,duration,artist,type_code+1 from copy_d_songs 25.1. select 'Azi este a '||trunc(sysdate+1-to_date('01-01-2008','DD-MM-YYYY'))||' -a zi a anului' from dual 25.2. - create table copy_d_events as select * from d_events - select * from copy_d_events order by event_date 25.3. - insert into copy_d_events values(1,'Nume',sysdate,'Descriere',1,1,1,1,1) - insert into copy_d_events values(2,'Nume1',sysdate+1,'Descriere1',1,1,1,1,1) - select name,description,cost*1.19 from copy_d_events 25.4. - alter table copy_d_events drop column package_code - alter table copy_d_events drop column theme_code - select * from copy_d_events 26. select upper('Examen de atestat la informatica') from dual 27. select 'Textul "Examen de atestat la informatica" are '||length('Examen de atestat la informatica')||' caractere' from dual 28. select replace('E bine bine e foarte bine','bine','rau') from dual 3
29. select replace(lower('Doua rate fac doua oua in doua zile'),'doua','') from dual 30. select rpad('Examen',15,'+')||' si '||lpad('Informatica',20,'-') from dual