The Handy Library Manager utilizes the Firebird SQL database engine. Our library database system consists of several tables, which we categorize into two types: data tables (Library, Copies, and Borrowers) and transaction tables (Loans and Reservations). Both data and transaction tables contain unique identification numbers in their respective "ID" fields. These fields can be used to join multiple tables together, enabling further analysis, summaries, or reports.
In certain situations, you may need to join several tables to retrieve additional information. For example, in a small elementary school using the system, student records include class information. If there are many overdue items in the library, a librarian might want to generate a report of overdue books categorized by class. Since loan transactions do not store class data, you would need to create a temporary table that consolidates information from the Loans and Borrowers tables.
Using SQL definitions provides significant flexibility in finding answers to various questions about your library, such as:
- What book category is the most popular?
- What is the number of loans by patron type?
- What is the number of loans by student class and age?
- What is the number of loans by month?
- Which book has the largest number of copies?
- What is the number of loans per borrower?
The same query you can enter in the following form:
SELECT BORROWERS.NAME, BORROWERS.TYPE, LIBRARY.TITLE, LOAN.RETURNDATE, LOAN.DUEDATE FROM LOAN JOIN BORROWERS ON LOAN.BOR_IDNO=BORROWERS.BOR_IDNO JOIN LIBRARY ON LOAN.ITEM_IDNO=LIBRARY.IDNO
In this query we refer to the table's fields using the table name.
Tables and fields used in the query:
A - Loans table (LOAN), data fields: RETURNDATE, DUEDATE, ITEM_IDNO
B - Borrowers table (BORROWERS), data fields: NAME, TYPE, BOR_IDNO
C - Libary Items table (LIBRARY), data fields: TITLE, IDNO
SELECT B.NAME, B.TYPE, C.TITLE, A.RETURNDATE, A.DUEDATE
this part defines data displayed
FROM LOAN A JOIN BORROWERS B ON A.BOR_IDNO=B.BOR_IDNO JOIN LIBRARY C ON A.ITEM_IDNO=C.IDNO
this part difines what tables are joined and by which data field.
All loan transactions are listed.
To the same SQL definition as above a condition is added. List only items that were not returned.
WHERE A.RETURNDATE IS NULL
Only outstanding loans are listed (not returned items).
To the same SQL definition as above a new condition is added. List only not returned items for borrowers who have Child as a type.
AND B.TYPE='Child'
Only outstanding loans where borrower's type is equal to Child are listed.
Question: I have a question about sql, how to join 3 tables, I want to link, borrowers, loans, items and display for example 4 fields: PatronName, PatronType, ItemTitle, ReturnDate, DueDate
Handy Library Manager 4.4, review new features
Inquiries from Librarians and Libraries
Library Web Search, review new web search
Library Search 4.0, review new desktop search
Getting started library video lessons
How to include library name on labels
Library, Data Entry Form Designer
Edit item or borrower data in the check-in/check-out window?
Link item lost fine with the PRICE data field?
Handy v3.2 supports letter tabs?
How to predefine library email messages?
How to update library data from the web with ISBN?
How to predefine library email messages?
Compilation of questions and answers from library requests will help you to make purchase decision.
How to verify if the item is checked out in the library main catalog window?
How to create a new record using Copy Selected Item?
Special Library, how to manage digital and paper document library?
What is the maximum number of library items?
Library Software for Small Libraries, Windows application
Handy Library Manager
small library software
library tour
library features
try now, download
cloud
library software reviews
Copyright © 2025 · All Rights Reserved · PrimaSoft PC