Advertisement
hgr24

Untitled

Mar 30th, 2022
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.76 KB | None | 0 0
  1. SELECT B.BOOK_ID, B.TITLE, B.PUBLISHER_NAME, A.AUTHOR_NAME,
  2.  C.NO_OF_COPIES, L.BRANCH_ID
  3. FROM BOOK B, BOOK_AUTHORS A, BOOK_COPIES C
  4. WHERE B.BOOK_ID=A.BOOK_ID
  5.  AND B.BOOK_ID=C.BOOK_ID;
  6.  
  7.  
  8. SELECT CARD_NO
  9.  FROM BOOK_LENDING
  10.  WHERE DATE_OUT BETWEEN '01-JAN-2017' AND '01-JUL-2017'
  11.  GROUP BY CARD_NO
  12.  HAVING COUNT (*)>3;
  13.  
  14.  
  15. DELETE FROM BOOK
  16. WHERE BOOK_ID='3';
  17.  
  18.  
  19.  
  20. CREATE TABLE BOOKPART
  21. PARTITION BY RANGE (PUB_YEAR)
  22. (PARTITION P1 VALUES LESS THAN(2016),
  23. PARTITION P2 VALUES LESS THAN (MAXVALUE))
  24. AS SELECT * FROM BOOK;
  25.  
  26.  
  27. CREATE VIEW BC AS
  28. SELECT B.BOOK_ID,C.TITLE,B.BRANCH_ID,
  29.  (B.NO_OF_COPIES-(SELECT COUNT(*)
  30.  FROM BOOK_LENDING L
  31. WHERE B.BOOK_ID=L.BOOK_ID AND
  32.  B.BRANCH_ID=L.BRANCH_ID))
  33.  AS NO_COPY
  34. FROM BOOK_COPIES B,BOOK C
  35. WHERE B.BOOK_ID=C.BOOK_ID;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement