Advertisement
LDG2875

Untitled

Oct 28th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. B1
  2. CREATE TABLE BACALAUREAT (
  3. cnp VARCHAR(13),
  4. nume VARCHAR(50),
  5. nota1 DECIMAL(5 , 2 ),
  6. nota2 DECIMAL(5 , 2 ),
  7. nota3 DECIMAL(5 , 2 ),
  8. medie DECIMAL(5 , 2 ),
  9. an_examen INT,
  10. data_nastere DATE
  11. );
  12.  
  13. insert into BACALAUREAT values("12341234", "1", 1, 2, 1, 123, 22-12-2002);
  14. insert into BACALAUREAT values('2234567890123', 'Floricica Dansatoarea2', 2, 5, 3, 123, 22-11-2002);
  15. insert into BACALAUREAT values('3234567890123', 'Floricica Dansatoarea3', 3, 6, 5, 123, 22-10-2002);
  16. insert into BACALAUREAT values('4234567890123', 'Floricica Dansatoarea4', 4, 7, 7, 123, 22-9-2002);
  17. insert into BACALAUREAT values('5234567890123', 'Floricica Dansatoarea5', 5, 8, 9, 123, 22-8-2002);
  18. insert into BACALAUREAT values('6234567890123', 'Floricica Dansatoarea6', 6, 9, 8, 123, 23-12-2002);
  19. insert into BACALAUREAT values('7234567890123', 'Floricica Dansatoarea7', 7, 10, 2, 123, 25-12-2002);
  20.  
  21. select nume from BACALAUREAT order by (nota1 = 10 OR nota2 = 10 OR nota3 = 10);
  22.  
  23. update BACALAUREAT
  24. set medie = (nota1 + nota2 + nota3) / 3;
  25.  
  26. select max(medie) from BACALAUREAT;
  27.  
  28.  
  29.  
  30. B3
  31. CREATE TABLE BACALAUREAT (
  32. cnp VARCHAR(13),
  33. nume VARCHAR(50),
  34. nota1 DECIMAL(5 , 2 ),
  35. nota2 DECIMAL(5 , 2 ),
  36. nota3 DECIMAL(5 , 2 ),
  37. medie DECIMAL(5 , 2 ),
  38. an_examen INT,
  39. data_nastere DATE
  40. );
  41.  
  42. insert into BACALAUREAT values("12341234", "1", 1, 2, 1, 123, 22-12-2002);
  43. insert into BACALAUREAT values('2234567890123', 'Floricica Dansatoarea2', 2, 5, 3, 123, 22-11-2002);
  44. insert into BACALAUREAT values('3234567890123', 'Floricica Dansatoarea3', 3, 6, 5, 123, 22-10-2002);
  45. insert into BACALAUREAT values('4234567890123', 'Floricica Dansatoarea4', 4, 7, 7, 123, 22-9-2002);
  46. insert into BACALAUREAT values('5234567890123', 'Floricica Dansatoarea5', 5, 8, 9, 123, 22-8-2002);
  47. insert into BACALAUREAT values('6234567890123', 'Floricica Dansatoarea6', 6, 9, 8, 123, 23-12-2002);
  48. insert into BACALAUREAT values('7234567890123', 'Floricica Dansatoarea7', 7, 10, 2, 123, 25-12-2002);
  49.  
  50. select nume from BACALAUREAT order by (nota1 = 10 OR nota2 = 10 OR nota3 = 10);
  51.  
  52. update BACALAUREAT
  53. set medie = (nota1 + nota2 + nota3) / 3;
  54.  
  55. select nume from BACALAUREAT where (medie >= 5 AND medie <= 8);
  56. select count(nume) from BACALAUREAT where (nota1 >= 5 AND nota2 >= 5 AND nota3 >= 5 AND medie >= 6);
  57. delete from BACALAUREAT where (data_nastere <= 15-01-1980);
  58.  
  59.  
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement