daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Jan 16th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --1
  2. select cod_localitate, cod_magazin, cod_prajitura, count(data_achizitie)
  3. from magazin join prajitura using (cod_magazin)
  4. join cumpara using (cod_prajitura)
  5. where to_char(data_achizitie, 'DD-MON-YYYY') <= '10-JAN-2019'
  6. and 500 <= (select count(data_achizitie)
  7.             from cumpara)
  8. and telefon not null
  9. group by cod_localitate, cod_magazin, prajitura
  10. order by cod_magazin
  11. order by cod_prajitura desc;
  12.  
  13. --2
  14. select nume, prenume
  15. from client join cumpara using (cod_client)
  16. join prajitura using (cod_prajitura)
  17. join magazin using (cod_magazin)
  18. where cantitate in (
  19.       select cod_client, max(cantitate)
  20.       from prajitura
  21.       group by cod_client)
  22. and cod_localitate=1;
  23.  
  24. --3
  25. select cod_prajitura, denumire
  26. from prajitura join cumpara using (cod_prajitura)
  27. where cod_prajitura in (--1
  28. select cod_localitate, cod_magazin, cod_prajitura, count(data_achizitie)
  29. from magazin join prajitura using (cod_magazin)
  30. join cumpara using (cod_prajitura)
  31. where to_char(data_achizitie, 'DD-MON-YYYY') <= '10-JAN-2019'
  32. and 500 <= (select count(data_achizitie)
  33.             from cumpara)
  34. and telefon not null
  35. group by cod_localitate, cod_magazin, prajitura
  36. order by cod_magazin
  37. order by cod_prajitura desc;
  38. --4
  39. create table angajati (
  40.     cod_angajat number(4) constraint cod_ang_pk primary key,
  41.     nume varchar2(20) constraint nume_not_null not null,
  42.     presnume varchar2(20),
  43.     cod_magazin number(10) constraint cod_mag_fk foreign key(cod_magazin)
  44.     references magazine(cod_magazin),
  45.     data_nastere varchar2(10));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top