0% found this document useful (0 votes)
114 views6 pages

Atestat Baze de Date

This document contains 30 problems related to querying databases. Each problem contains two SQL queries (b and c) related to different tables and columns in a database. The queries select, filter, aggregate and order data to answer business questions.

Uploaded by

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

Atestat Baze de Date

This document contains 30 problems related to querying databases. Each problem contains two SQL queries (b and c) related to different tables and columns in a database. The queries select, filter, aggregate and order data to answer business questions.

Uploaded by

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

Rezolvari Atestat:Baze de Date

Baze de date
 Problema 1:
b) select medic from consultatii

where to_date(data_consult,'dd/mon/yyyy')='01/dec/12' ;
c) select sum(b.pret) as "Suma platita" from pacienti a,consultatii b .
where a.cnp=b.cnp and trim(upper(a.nume))='GEORGESCU PAUL'

 Problema 2:
b) select b.nume,b.prenume from destinatii a,clienti2 b

where a.id=b.idd and trim(upper(a.nume))='VIENA'


order by b.nume ;
c) select nume from destinatii
where pret in ((select min(pret) from destinatii) ,(select max(pret) from destinatii)) .

 Problema 3:
b) select a.nume,a.prenume,b.data_inregistrarii as"Data inregistrarii " from abonati
a,interventii b
where a.cnp=b.cnp and to_date(data_inregistrarii,'dd/mon/yyyy')= '1/jan/2013' ;
c) select data_inregistrarii,termen_limita from interventii
where trim(upper(stare))='NEEFECTUAT' .

Problema 4: NU
 Problema 5:
b) select a.nume,a.adresa,b.nume_caine as "Numele cainelui" ,b.premiu from stapani
a,caini b
where a.cnp=b.cnp and trim(lower(a.nume))='vladoi cristinel' ;
c) select a.nume as"Numele stapanului",b.nume_caine as"Numele cainelui",b.premiu from
stapani a,caini b
where a.cnp=b.cnp
order by b.premiu .

 Problema 6:
b) select b.nume,a.denumire,b.data_nasterii from specii a,animale b
Rezolvari Atestat:Baze de Date

where a.ids=b.ids and sysdate-b.data_nasterii=(select max(sysdate-data_nasterii) from


animale) ;
c) select Initcap(b.nume) as "Nume", Initcap(a.denumire) as "Denumire" from specii a,
animale b
where a.ids=b.ids
order by a.denumire .

 Problema 7:
b)-----;
c) select a.denumire,a.capitala,b.populatie,b.nume as"Numele orasului" from tari a,orase b
where a.cod_t=b.cod_t and b.populatie in ((select min(populatie) from orase) , (select
max(populatie) from orase)) .

 Problema 8:
b) select a.nume,a.prenume,b.denumire as"Reclama" from clienti a,reclame b
where a.idc=b.idc
order by a.nume asc ;
c) select a.nume,a.prenume,a.adresa from clienti a,reclame b
where a.idc=b.idc and b.nr_difuzari=(select max(nr_difuzari) from reclame) .

 Problema 9:
b)-----;
c) select sum(a.locuri)as "Numar de persoane" from masini a,curse b
where a.id=b.idm and to_char(b.data_plecarii,'dd/mon/yy'y)='01/May/2013' .

 Problema 10:
b) select b.titlu,b.autor,b.pret from edituri a,carti b

where a.cod=b.cod and trim(lower(a.nume))='nemira'

order by b.titlu ;

c) select sum(pret) As"Pret total" from carti

where trim(lower(autor))='ion creanga' .

 Problema 11:
b) select a.denumire as"Departament",b.nume as"Coordonator" from departamente
a,angajati b
Rezolvari Atestat:Baze de Date

where a.cod=b.cod and trim(lower(b.functia))='coordonator departament' ;

c) select a.denumire,count(b.cnp) as"Nr angajati" from departamente a,angajati b

where a.cod=b.cod

group by a.denumire .

Problema 12: NU.

 Problema 13:
b) select a.adresa,b.etaj as "Etaj",b.cod as"Numarul" from cladiri a,apartamente b

where a.cod=b.cod_cladire and a.nivele>2 ;

c) select a.adresa,b.etaj as "Etaj",b.cod as"Numarul",b.camere from cladiri a,apartamente b

where a.cod=b.cod_cladire and b.camere=(select max(camere) from apartamente) .

 Problema 14:
b) select a.denumire,avg(b.varsta) as"Media" from cluburi a,sportivi b

where a.cod=b.cod_club

group by a.denumire

order by a.denumire;

c) select b.nume,b.prenume,a.denumire,b.varsta from cluburi a,sportivi b

where a.cod=b.cod_club and b.varsta=(select max(varsta) from sportivi)

order by b.nume .

 Problema 15:
b) select b.nume,b.prenume,a.suma_restanta from locatari b,apartamente15 a

where a.coda=b.coda and a.suma_restanta=(select max(suma_restanta) from


apartamente15) ;

c) select nume,prenume,loc_munca from locatari

where loc_munca=: JOB

order by nume .

Problema 16:NU
Rezolvari Atestat:Baze de Date

 Problema 17:
b) select a.nume,b.nume as "echipa" from jucatori a,echipe b

where a.code=b.code and b.nume=:ECHIPA ;

c) select b.nume, avg(a.salariu) as"Media salariilor" from jucatori a,echipe b

where a.code=b.code

group by b.nume .

 Problema 18:
b) select b.nume,b.prenume,b.absente,a.tip from burse a,elevi18 b

where a.id=b.id and b.absente=(select max(absente) from elevi) and


trim(upper(a.tip))='SOCIALA' ;

c) select a.tip,count(b.cnp) as"Numar de burse alocate" from elevi18 b,burse a

where a.id=b.id

group by a.tip .

 Problema 21:
b) select nume,pret from rechizite

order by pret desc ;

c) select a.nume,sum(b.cantitate) as"Cantitatea totala" from rechizite a,vanzari b

where a.id=b.idr

group by a.nume .

 Problema 22:
b) select destinatie,durata from excursii

where durata<10 and lower(substr(destinatie,1,1) )not in ('a','e','i','o','u') ;

c) select a.destinatie,b.nume from excursii a,turisti b

where a.id=b.ide

order by b.nume desc .


Rezolvari Atestat:Baze de Date

 Problema 23:
b) select a.nume,a.prenume,a.nr_tel from mecanici a,masini23 b

where a.cnp=b.cnp and to_char(b.data_reparatiei,'dd/mon/yyyy')='01/may/2013' ;

c) select sum(b.pret) from mecanici a,masini23 b

where a.cnp=b.cnp and trim(lower(b.nume_proprietar))='ionescu vasile'

 Problema 25:
b) select a.titlu,b.nume,a.domeniu from publicatii a,abonamente b

where a.id=b.idp and trim(upper(a.domeniu))=’IT’

order by b.nume ;
c) select a.id as”Cod publicatie”,a.titlu as “Titlu publicatie”,a.domeniu as”Domeniul tratat”
,a.pret as”Pretul”,a.pret+(a.pret*24/100) as”Pret cu TVA” from publicatii a,abonamente b .
Problema 26:NU

 Problema 27:
b)select a.denumire as”Denumirea proiectului”,b.buget as”Buget
vechi”,b.buget+10/100*buget as”Buget nou” from proiecte a,participant b
where a.id=b.idp ;
c)select denumire,data from proiecte
where to_char(data,’dd/mon/yyyy’)=’dd/mon/2009’.

 Problema 28 :
b) select b.prenume,a.clasa from diriginti a,elevi b
where .id=b.ide and trim(lower(a.clasa))=’9b’ ;
c) select b.numea as “Nume elev”,b.prenume as “Prenume elev”,a.nume as “Nume diriginte”
,a.prenume as “Prenume diriginte” from diriginti a,elevi b
where a.id=b.ide and a.specializare=:Specializarea
order by b.nume asc .

 Problema 29:
b) select b.titlu as”Titlul filmului”,b.buget as”Bugetul”,b.an as”Anul aparitiei”,a.nume as
“Numele regizorului” from regizori a,filme b
where a.id=b.idf and buget<30000
Rezolvari Atestat:Baze de Date

order by b.titlu asc;


c)-----.

 Problema 30 :
b) select b.nume,b.salariu,a.denumire as”Aria curricular” from arii a,profesori b
where a.cod=b.cod and premiu=NULL ;
c) select min(b.salariu) as”Salariul minim”,max(b.salariu) as “Salariul maxim”,a.denumire as
“Aria curricular” from arii a,profesori b
where a.cod=b.cod
group by a.denumire .

You might also like