Advertisement
korenizla

sap_task4:

Aug 4th, 2023
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. CREATE TABLE INTERNET (
  2. PUR_DATE DATE,
  3. IM VARCHAR(100),
  4. SKD INT,
  5. PRICE INT
  6. );
  7. INSERT INTO INTERNET (PUR_DATE, IM, SKD, PRICE)
  8. VALUES
  9. ('2021-02-02', 'ZOOSHOP', 1, 5000),
  10. ('2021-02-04', 'ZOOSHOP', 1, 5000),
  11. ('2021-02-05', 'ZOOSHOP', 2, 3700),
  12. ('2021-02-08', 'ZOOSHOP', 2, 3700),
  13. ('2021-02-09', 'ZOOSHOP', 3, 1800),
  14. ('2021-02-13', 'PROMARKET', 1, 5000),
  15. ('2021-02-14', 'PROMARKET', 4, 2200);
  16.  
  17. SELECT (SELECT SUM(PRICE)
  18. FROM INTERNET
  19. WHERE PUR_DATE <= T1.PUR_DATE) COSTS
  20. FROM INTERNET T1
  21. ORDER BY IM, PUR_DATE
  22. OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement