Advertisement
patryk

SBD_L08

Apr 22nd, 2015
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.05 KB | None | 0 0
  1. -- ZAD 1
  2. CREATE OR REPLACE VIEW ASYSTENCI (ID, NAZWISKO, PLACA, STAŻ_PRACY) AS
  3.   SELECT ID_PRAC, NAZWISKO, PLACA_POD, 'lat: '
  4.   || ROUND( (MONTHS_BETWEEN(CURRENT_DATE, ZATRUDNIONY) / 12 ), 0)
  5.   || ', miesięcy: '
  6.   || ROUND( ( MOD( MONTHS_BETWEEN(CURRENT_DATE, ZATRUDNIONY), 12) ), 0)
  7.   FROM PRACOWNICY WHERE ETAT = 'ASYSTENT';
  8.  
  9. -- ZAD 2
  10. CREATE OR REPLACE VIEW PLACE (ID_ZESP, SREDNIA, MINIMUM, MAXIMUM, FUNDUSZ, L_PENSJI, L_DODATKOW) AS
  11.   SELECT ID_ZESP, AVG(PLACA_POD + NVL(PLACA_DOD, 0)), MIN(PLACA_POD + NVL(PLACA_DOD, 0)),
  12.   MAX(PLACA_POD + NVL(PLACA_DOD, 0)), SUM(PLACA_POD + NVL(PLACA_DOD, 0)), COUNT(PLACA_POD), COUNT(PLACA_DOD)
  13.   FROM PRACOWNICY GROUP BY ID_ZESP ORDER BY ID_ZESP ASC;
  14.  
  15. -- ZAD 3
  16. SELECT P.NAZWISKO, P.PLACA_POD FROM PRACOWNICY P
  17.   WHERE ( P.PLACA_POD + NVL(P.PLACA_DOD, 0) ) < (SELECT SREDNIA FROM PLACE PL WHERE PL.ID_ZESP = P.ID_ZESP);      
  18.  
  19. -- ZAD 4
  20. CREATE OR REPLACE VIEW PLACE_MINIMALNE (ID_PRAC, NAZWISKO, ETAT, PLACA_POD) AS
  21.   SELECT ID_PRAC, NAZWISKO, ETAT, PLACA_POD FROM PRACOWNICY WHERE PLACA_POD < 700;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement