Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1.  
  2. insert into studenti ( nr_matricol, nume) values ( 201,'Gigi');
  3. /
  4.  
  5. update studenti set an = 3
  6. where nr_matricol = 201;
  7. /
  8. delete from note where nr_matricol = 200;
  9. /
  10. delete from studenti where nr_matricol =200;
  11. /
  12.  
  13. select distinct bursa from studenti;
  14. /
  15.  
  16. select nume || ', ' || prenume || ', ' || an as "Studenti pe an" from studenti order by an;
  17. /
  18.  
  19. select nume,prenume from studenti where data_nastere between to_date('01/01/1995','dd/mm/yyyy') and to_date('10/06/1997','dd/mm/yyyy');
  20. /
  21.  
  22. select nume,prenume,an from studenti where extract(year from data_nastere) = '1995';
  23. /
  24.  
  25. select * from studenti where bursa is null;
  26. /
  27.  
  28. select * from studenti where prenume like '%a%a%';
  29. /
  30.  
  31. create table str_neretantieri
  32. ( nr_matricol varchar2(10),
  33. id_curs varchar2(10),
  34. valoare number(2) not null,
  35. primary key (nr_matricol, id_curs),
  36. constraint ck_valaore check (valoare between 5 and 10));
  37. /
  38.  
  39. insert into STR_NERETANTIERI values (444,21,6);
  40. /
  41.  
  42. drop table str_neretantieri;
  43. /
  44.  
  45. select current_date as "Astazi" from dual;
  46.  
  47.  
  48. select nume , data_nastere, MONTHS_BETWEEN(current_date,data_nastere) from studenti ;
  49. /
  50.  
  51. SELECT GREATEST('Mihai','Andrei','Anca') "GREATEST" FROM DUAL;
  52. /
  53.  
  54. -- 6
  55. select 'b' || upper(substr(nume,1)), length(trim(nume)) from profesori where nume like 'B%';
  56. /
  57.  
  58. --8
  59. select nume, prenume, to_char(data_nastere,'MON') as "MONTH" from studenti where bursa is not null;
  60. /
  61.  
  62. --9
  63. select nume, bursa, decode(bursa, '450', 'primul' , 350,'premiul 2' , 250, 'premiul 3', null , 'mentiune') as "premiu" from studenti;
  64.  
  65. --10
  66. select replace(replace(replace(nume,'i','a'), 'a','i'), 'i', 'a') from studenti;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement