Changes between Version 4 and Version 5 of Напредни извештаи од базата (SQL и складирани процедури)


Ignore:
Timestamp:
12/23/24 16:03:58 (3 weeks ago)
Author:
222039
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Напредни извештаи од базата (SQL и складирани процедури)

    v4 v5  
    1010LIMIT 5;
    1111}}}
    12 ==
     12
     13=== Извештај за најпозајмени книги ===
     14{{{$!sql
     15SELECT book.CoverImage, book.Title, book.Genre, author.FirstName, author.LastName, COUNT(loan.LoanID) AS loan_count FROM book
     16INNER JOIN book_copies ON book.BookID = book_copies.BookID
     17LEFT JOIN loan ON book_copies.CopyID = loan.BookCopyID
     18INNER JOIN book_author ON book.BookID = book_author.BookID
     19INNER JOIN author ON book_author.AuthorID = author.AuthorID
     20GROUP BY book.BookID, book.Title, book.CoverImage, book.Genre, author.FirstName, author.LastName
     21ORDER BY loan_count DESC LIMIT 5;
     22}}}
     23
     24=== Извештај за најмалку позајмувани книги ===
     25{{{$!sql
     26SELECT book.CoverImage, book.Title, book.Genre, author.FirstName, author.LastName, COUNT(loan.LoanID) AS loan_count FROM book
     27INNER JOIN book_copies ON book.BookID = book_copies.BookID
     28LEFT JOIN loan ON book_copies.CopyID = loan.BookCopyID
     29INNER JOIN book_author ON book.BookID = book_author.BookID
     30INNER JOIN author ON book_author.AuthorID = author.AuthorID
     31GROUP BY book.BookID, book.Title, book.CoverImage, book.Genre, author.FirstName, author.LastName
     32ORDER BY loan_count ASC LIMIT 5;
     33}}}