Changes between Version 5 and Version 6 of Напредни извештаи од базата (SQL и складирани процедури)
- Timestamp:
- 01/21/25 07:10:58 (30 hours ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Напредни извештаи од базата (SQL и складирани процедури)
v5 v6 46 46 coalesce(( 47 47 select count(*) 48 from Library l join LibraryBook lb on l.InventoryId = lb.InventoryId48 from Library l join ContainsLibraryBook lb on l.InventoryId = lb.InventoryId 49 49 where l.UserId=u.UserId 50 50 ), 0) as NumberOfBooksOwned, … … 65 65 extract(quarter from t.BorrowDate) as quarter, 66 66 b.Title, b.Author, count(*) as NumberOfTimesBorrowed 67 from Transaction t join TransactionBook tb on t.TransactionId=tb.TransactionId join Book b on tb.BookId = b.BookId67 from Transaction t join ExchangingBook eb on t.TransactionId=eb.TransactionId join Book b on eb.BookId = b.BookId 68 68 group by 69 69 extract(year from t.BorrowDate), … … 91 91 {{{ 92 92 select b.Title, b.Author, count(*) as TimesAddedToWishlist 93 from WishlistBook wb join Book b onwb.BookId = b.BookId93 from ContainsWishlistBook cwb join Book b on cwb.BookId = b.BookId 94 94 group by b.BookId, b.Title, b.Author 95 95 order by TimesAddedToWishlist desc … … 104 104 with BookSwapCount as( 105 105 select b.Title, extract(year from t.BorrowDate) as SwapYear, count(tb.BookId) as SwapCount 106 from Transaction t join TransactionBook tb on t.TransactionId=tb.TransactionId107 join Book b on tb.BookId=b.BookId106 from Transaction t join ExchangingBook eb on t.TransactionId=eb.TransactionId 107 join Book b on eb.BookId=b.BookId 108 108 group by b.title, extract(year from t.borrowdate) 109 109 ) … … 127 127 select au.Username, avg(r.Rating) as AverageRating 128 128 from AppUser au join Review r on au.UserId=r.ReceiverId 129 where r. Date between '2025-01-01' and '2025-06-30'129 where r.ReviewDate between '2025-01-01' and '2025-06-30' 130 130 group by au.Username 131 131 )