Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Voyager : Query Basic
1. Voyager Reporting Basic SQL and a print monograph record 1
Voyager Reporting
Basic SQL and a print monograph record
Michael Cummings
George Washington University Libraries
January, 2014
2. Voyager Reporting Basic SQL and a print monograph record 2
Table of Contents
Introduction.......................................................................................................................................4
MARC 21 format bibliographic data.................................................................................................4
Voyager Catalog – Bibliographic record............................................................................................5
MARC format holding data (“mfhd” or “muffhead”) record. ............................................................6
MARC format holding data– ExLibris Voyager Catalog module view ..................................................7
Bib, Holdings, and Items– ExLibris Voyager Catalog module view.......................................................8
Item record – ExLibris Voyager Circulation module view....................................................................9
ExLibris Voyager Acquisitions module view.....................................................................................10
Reports using SQL.............................................................................................................................11
SQL query bib_text table...............................................................................................................12
Cataloginformation – bib_text table..............................................................................................13
SQL query bib_index table.............................................................................................................14
SQL query bib_ids of titles having a specific main author.................................................................15
SQL sort .......................................................................................................................................15
SQL query the bib_master table.....................................................................................................16
Special function for handling Unicode in MS Access........................................................................17
SQL query – a specific holding record............................................................................................19
SQL query – location.....................................................................................................................20
SQL query - holding record(s) associated with a bib record.............................................................21
SQL query – a specific item record .................................................................................................22
SQL query – item barcode anditem status .....................................................................................23
SQL query – item(s) associatedwith a holding record......................................................................23
SQL query – holding(s) and item(s) associated with a bib record......................................................23
SQL query – specific purchase order byid.......................................................................................24
SQL Query – line items on a specific purchase order .......................................................................25
SQL Query – purchase order and line item matching a bib_id..........................................................26
SQL query – invoice line item price for a given bib_id......................................................................27
SQL query – invoice line item and fund/ledger for a given bib_id.....................................................27
SQL query – price, fund, and ledger from aninvoice for a specific bib_id..........................................28
SQL Query summary profile of a bib_id print holding with one item.................................................29
Reference materials............................................................................Error! Bookmark not defined.
4. Voyager Reporting Basic SQL and a print monograph record 4
Introduction
Thisdocumenttakesyouthroughthe Voyagersystemtablesassociatedwithaparticularbook,
“Philosophy:the questfortruthand meaning”whichisownedbyGWU. Some basic SQL query
statementswill be explainedhere. The mostimportantthingtoknow whenyouwantto develop
reportsfromVoyagerdatabase iswhichtablesandfieldsstore the informationyouwant. Let’stake a
lookat our example,beginning withthe machinereadable catalogrecord(MARC21).
MARC 21 format bibliographic data
“Philosophy:the questfortruthand meaning”
01746cam a2200397 a
45000010008000000050017000080080041000250100017000660200018000830200015001010
20002700116020002400143035002100167035002400188040004600212049000900258050002
10026708200120028810000200030024500680032026000530038830000250044150000300046
65040051004966500031005478520010005789380040005889380051006289490019006799610
02000698980004700718981001200765994001200777990037700789991018201166-7977843-
20100412201423.0-091027s2010 mnu b 001 0 eng - a 2009045526- -
a9780814654743- a0814654746- a9780814657270 (e-book)- a0814657273 (e-
book)- a(OCoLC)457164785- a(OCoLC)ocn457164785- aDLCcDLCdBTCTAdYDXCPdC#P-
dBWXdOrLoB-B- aDGWW-00aBD21b.B325 2010-00a100222-1 aBeards, Andrew.-10-
aPhilosophy :bthe quest for truth and meaning /cAndrew Beards.- -
aCollegeville, Minn. :bLiturgical Press,cc2010.- aix, 142 p. ;c23 cm.- a"A
Michael Glazier book."- aIncludes bibliographical references and index.- 0-
aPhilosophyvIntroductions.- bgwg w- aYBP Library ServicesbYANKn3143509- -
aBlackwell Book ServicebBBUSnR8835802c$16.95- b32882019588535- aNew title
added- a2010-04-01b16.95c.21e14.07f50124698g1- aAppv206- a92bDGW- 0gCh.
1.tWhat is this thing called "philosophy"? --gCh. 2.tThe process of coming to
know --gCh. 3.tKnowing in common sense, science, history, and art --gCh. 4.-
tPositions on the theory of knowledge --gCh. 5.tMetaphysics : what philosophy
can tell us about reality --gCh. 6.tA short introduction to ethics --gCh. 7.-
tPhilosophy of religion and the question of God.- aAndrew Beards is reader
in philosophy and director of the distance-learning B.A. Philosophy and the
Catholic Tradition program at Maryvale Institute, Birmingham, United
Kingdom.-
MARC is a standardformat thatcan be parsedby IntegratedLibrarySystems like Voyager.
There isa Pythonmodule,pymarc.py,whichcanreadMARC data records.
WithcertainVisualBasicmodulesfor MSAccess it ispossible toreadMARC data. ExLibris
providesthe necessaryVBmodulesinthe MSAccessdatabase providedwithVoyager.
There are functionsinExlibris’VoyagerOracle database thatSQLPlussoftware canuse toread
MARC data records.
Othertoolslike ‘VGERSelect’fromNorthwesternUniversity,andMARC-editafree opensource
software productcan readMARC data records.
5. Voyager Reporting Basic SQL and a print monograph record 5
Voyager Catalog – Bibliographic record
Next,let’slookat the same recordin the VoyagerCatalogmodule.Eachtitle getsasystem-generated
idnumber.Inthiscase, the bibliographicidis7977843. This isthe “bib_id.”
6. Voyager Reporting Basic SQL and a print monograph record 6
Note:Thissample recordwasintentionallyselectedinordertoshow how some vendorsuse tags
available forcustomuse (9xx tags). 1
The sample recordwas providedbythe vendorYBP Library
Servicesaspart of a pre-arrangedbookpurchase approval plan. The record containssome fieldsthatare
not usuallypresenton ourbibliographicrecords. Itcontainsfieldsthatrepresentnotonlythe
bibliographicdescription,butalsothe associated item’scall numberand barcode. The recordalso
containssome financial information. Asareportwriteryoushouldbe aware that youshouldonlyexpect
bibliographicdescriptionfieldsonabibrecord. In actual practice,the bibliographicrecordisjustthat,a
descriptionof the mainbibliographicrecord.
The bib recordis the top-level recordinahierarchyof records;
o The bib recordshave one or more local holdingrecords.The local holdingrecord
containsthe call number, andthe linktoan electronicresource,if any.
Each holdingrecordmayhave one or more itemrecords.Itemrecords
describe aphysical copy and informationthe physical itemsuchasa
location,barcode,circulationdata,andcostdata.
MARC format holding data (“mfhd” or “muffhead”) record.
A bibliographicrecordmayhave zeroor more local holdingrecords. Mostoften,there isone holding.
The holdingrecord,like the bibliographicrecord isalsoa MARC data format.
00180nx a22000851
4500001000800000004000800008005001700016008003300033852002800066-91640
61-7977843-20100412201426.0-1004120u||||8|||4001uu|||0000000-0 bgwg w-
hBD21i.B325 2010-
1
For a complete listof MARCtagsand theiruse,see http://www.loc.gov/marc/bibliographic/
7. Voyager Reporting Basic SQL and a print monograph record 7
MARC format holding data– ExLibris Voyager Catalog module view
The Voyagersystemassignedanumbertothe holding,9164061. Thisishow the Voyagersystem
displaysthe MARC formatholdingdatarecord:
The record isknownas a ‘holding’record,oras a “mfhd” or “muffhead”record.
The MARC bibliographicandholdinginformationisstoredinExLibrisVoyager as:
MARC data format
A setof relational database tables.Voyageruses anOracle database.
The database records do notcontaineverytag foundinthe MARC records.
We will lookatthe database tablesrelatedtobibliographicandholdingrecords.First,let’scomplete the
bigpicture. The physical bookisrepresentedbyan“Item”record.
Each holdingmayhave zeroor more items.
Itemsare usedto record one or more copy of a holding.
8. Voyager Reporting Basic SQL and a print monograph record 8
Bib, Holdings, and Items– ExLibris Voyager Catalog module view
Thisscreenshotshowsthe three-level hierarchyof Voyagerdatabase records associatedwith
the title “Philosophy:the questfortruth andmeaning.”
o The bibliographicrecord(bib_id7977843) is ‘owned’byGW.
There isone holdingof the book (mfhd_id9164061).
The holdinglocationabbreviationis‘gwgw’,and
the call numberisBD21 .B325 2010
There is one itemlikedtothe holding.The itemtype is regularloan
(item_id5314835). The itemstatusiscurrentlynotcharged.
9. Voyager Reporting Basic SQL and a print monograph record 9
Item record – ExLibris Voyager Circulation module view
Detailsaboutthe itemare storedinthe Circulationmodule.
In thisscreenshot,youcansee the itemhistorytab.“Philosophy:the questfortruth and meaning” has
not circulated(Historical Charges=0). So much forapproval plans– but that’sanotherstory.
The itemdata is storedinrelational database tablesare associatedwiththe catalog.Some Voyager
database tablesrelatedtothe itemdescriptionare item,location,item_status,item_barcode,barcode.
OtherVoyagerdatabase tables are associatedwiththe Circulationfunctions suchas transactiondetails
to include patroninformation. Laterwe will lookatsome queriesthatlistouriteminformation.
10. Voyager Reporting Basic SQL and a print monograph record 10
ExLibris Voyager Acquisitions module view
So far we coveredthe CatalogandCirculationmodules.Financial informationsuchaspurchase orders,
invoices,andfundingisstoredinrelational databasetablesassociatedwiththe Acquisitionfunction.
Thisscreenshows
“Philosophy:the quest … meaning”was orderedviaPurchase Ordernumber146339;
One copy waspurchased;itwas paid on Invoice number50124698
o the bookwas chargedagainstthe 2010 Approvalsfund,onledgergwgel2010103206.
More detailsare available byselectingthe varioustabsshownonthe screen. Tablesrelatedto
acquisitionsinclude ledger,fund,fund_ledger_vw,purchase_order,invoice,invoice_line_item,
invoice_line_item_funds,vendor
11. Voyager Reporting Basic SQL and a print monograph record 11
Reports using SQL
If your workstationhasan Oracle ODBC driverinstalled andyourExLibrisreports.mdbAccess
database has been linkedthe Voyagertables,youcancopythe queriesshownbelow.Paste a
querystatement intothe SQLviewof the Accesswindow where youcreate anew query.After
youpaste the SQL statementintothe window youmayswitchtothe graphical userinterface
viewtosee the tables,fields,andtable joinsassociatedwiththe SQLstatement.
You may wantto use the graphical userinterface foryourquerydevelopment.Itisa loteasier
than the SQL commandinterface.
The main thingforyou to be familiarwithisthe setof tablesthatcontainthe data fieldsyou
wantto retrieve.
See the Reference sectionforalinkto the data dictionarywhichlistsall the Voyagertables.
12. Voyager Reporting Basic SQL and a print monograph record 12
SQL query bib_text table
The two tablesthatcontainalmostall of the bibrecorddata are named bib_textand bib_index.
An SQL querythatgeneratesthe listof all fieldsfrombib_texttable foroursample title sendsthe result
to the file nameditem_bibtextisshownhere.The “WHERE”statementmatchesona specificbib_id
number.The bib_idfieldisthe indexed(“key”) field; usingthe keyfieldasselectioncriteriaisvery
efficient:
SELECT * INTO temp_bibtext
FROM bib_text
WHERE bib_text.bib_id='7977843';
Compare the contentof bib_text table onthe nextpage to the MARC record on page 1 of this
document. Notice thatonlythe firstISBN listedonthe MARC recordis storedonthe bib_textrecord.
The queryabove savesthe resultsintoa table. If the querydoesnotinclude anINTOstatement,
the resultsare justdisplayedonthe screen. Whenqueryresultsare savedintoatable, the table maybe
exported.Anotherreasontosave the resultsof the queryintoa table isthat the new table maybe
included insome otherquery.
Informationforseveral recordscouldbe savedusingavariationof the WHERE clause such as
the following:
WHERE bib_text.bib_id between‘7977800’ and‘7977900’
13. Voyager Reporting Basic SQL and a print monograph record 13
Catalog information – bib_text table
BIB_ID
AUTHOR
TITLE
TITLE_BRIEF
UNIFORM_TITLE
EDITION
ISBN
ISSN
LCCN
NETWORK_NUMBER
SERIES
CODEN
GPONUM
STDTECH
OTHER_STD_NUM
BEGIN_PUB_DATE
END_PUB_DATE
PUB_DATES_COMBINED
PUBLISHER_DATE
PUB_PLACE
PUBLISHER
PUBLISHER_NUMBER
IMPRINT
LANGUAGE
BIB_FORMAT
RECORD_STATUS
ENCODING_LEVEL
DESCRIP_FORM
FIELD_008
PLACE_CODE
DATE_TYPE_STATUS
MAP_PROJECTION
MAP_MATH_DATA
7977843
Beards, Andrew.
Philosophy :the quest for truth and meaning / Andrew Beards.
Philosophy :the quest for truth and meaning /
9780814654743
2009045526
(OCoLC)457164785
2010
2010
c2010
Collegeville,Minn.:
Liturgical Press,
Collegeville,Minn.: Liturgical Press,c2010.
eng
am
c
a
091027s2010 mnu b 001 0 eng
mnu
s
This table showsthe resultsof the SQLqueryon the previouspage.
Some of the data isabbreviated,suchaslanguage=’eng’forEnglish;bib_format=’am’ indicatesthisisa
monograph.
One instance of anISBN,ISSN,LCCN,or NETWORK_NUMBER maybe storedona bib_textrecord.If
there are multiplesof these standardnumbers onthe MARC record,they’ll be recordedinthe bib_index
table.
** If you wantto filterresultsusingcontentsof the fieldsBIB_FORMAT,ISBN,ISSN,
NETWORK_NUMBER, AUTHOR, etc.,almostanybibliographicinformationyoushouldhave aWHERE
statement.However,thatstatementshouldbe basedonthe bib_indextable,notthe bib_texttable.
The bib_index table isdescribednext.
14. Voyager Reporting Basic SQL and a print monograph record 14
SQL query bib_index table
The table namedbib_index stores the ISBN values(INDEX_CODE= 020A, 020N, or ISB3), andthe subject
(INDEX_CODE=6500) associatedwiththe bibrecord. INDEX_CODE =010A isthe LCCN. The
DISPLAY_HEADINGcolumnshowsthe actual data, while the NORMAL_HEADINGcolumncontainsthe
data convertedforindexing.
The SQL querytoreport the resultsfrombib_indexis:
SELECT * INTO temp_bibindex
FROM bib_index
WHERE bib_index.bib_id='7977843';
These are the queryresults:
BIB_ID INDEX_CODE NORMAL_HEADING DISPLAY_HEADING
7977843 008D 2010 2010
7977843 008L eng eng
7977843 008P mnu mnu
7977843 010A 2009045526 2009045526
7977843 020A 9780814654743 9780814654743
7977843 020A 0814654746 0814654746
7977843 020A 9780814657270 E BOOK 9780814657270 (e-book)
7977843 020A 0814657273 E BOOK 0814657273 (e-book)
7977843 020N 9780814654743 9780814654743
7977843 020N 0814654746 0814654746
7977843 020N 9780814657270 9780814657270 (e-book)
7977843 020N 0814657273 0814657273 (e-book)
7977843 0350 OCOLC 457164785 (OCoLC)457164785
7977843 035A 457164785 (OCoLC)457164785
7977843 100H BEARDS ANDREW Beards,Andrew.
7977843 2450 PHILOSOPHYTHE QUEST FOR TRUTH
ANDMEANING
Philosophy:the questfortruthand
meaning/
7977843 2451 PHILOSOPHYTHE QUEST FOR TRUTH
ANDMEANING
Philosophy:the questfortruthand
meaning/
7977843 2452 PHILOSOPHYTHE QUEST FOR TRUTH
ANDMEANING
Philosophy:the questfortruthand
meaning/
7977843 6500 PHILOSOPHYINTRODUCTIONS PhilosophyIntroductions.
7977843 ISB3 9780814654743 9780814654743
7977843 ISB3 9780814657270 9780814657270 (e-book)
See the Reference sectionforalinkto the data dictionarywhichlistsall the possible index_codes.
15. Voyager Reporting Basic SQL and a print monograph record 15
SQL query bib_ids of titles having a specific main author
Since we are lookingatthe bib_index table,here isaslightdiversionfromourtitle “Philosophy:the
questfortruth and meaning”.
The fieldnormal_heading of the bib_index tableisindexed,asthe name of the table mightimply.You
can use the normal_heading valuesasselectioncriteriainqueries;the responseshouldbe veryquick.
For example,aquerytofindall catalogrecords where Andrew Beards isthe mainauthor:
SELECT BIB_MASTER.LIBRARY_ID,BIB_INDEX.BIB_ID,TITLE_BRIEF
INTO temp_bibindex
FROM bib_master,bib_index,bib_text
WHERE bib_index.index_code='100H'
AND
bib_index.normal_heading='BEARDS ANDREW'
AND
bib_index.bib_id=bib_text.bib_id
AND
bib_master.bib_id=bib_index.bib_id;
LIBRARY_ID BIB_ID TITLE_BRIEF
6 1973265 Philosophy:the questfortruthand meaning/
6 2091304 Objectivityandhistorical understanding/
14 5184857 Objectivityandhistorical understanding/
14 7976876 Philosophy:the questfortruthand meaning/
7 7977843 Philosophy:the questfortruthand meaning/
6 7993294 Insightandanalysis:essaysinapplyingLonergan's thought/
3 8148140 Namingreference andmetaphysics:Lonerganandanalytical philosophy/
2 8176057 Insightandanalysis:essaysinapplyingLonergan'sthought/
5 11879205 InsightandAnalysis
13 12454778 Insightandanalysis:essaysinapplying Lonergan'sthought/
Some titlesare listedmore thanonce,because eachconsortiumlibraryhastheirownbibrecord,and
the queryhas not filteredoutrecordsthatare flagged‘suppressfromdisplayinthe catalog’,if any.
SQL sort
The resultsshown above couldbe sortedbytitle.Tosort by title,addan“order by”statementtothe
endof the query:
Orderby TITLE_BRIEF
The library_id,andsuppressedflagare explainedonthe nextpage.
16. Voyager Reporting Basic SQL and a print monograph record 16
SQL query the bib_master table
The bib_mastertable identifiesthe idof the consortiumlibrarythatownsthe bibrecord,whetherthe
record shouldbe suppressedfromthe onlinepubliccatalog,andwhenthe recordwas created.
Normally, aqueryshouldomitsuppressedbibrecords.
BIB_ID 7977843
LIBRARY_ID 7
SUPPRESS_IN_OPAC N
CREATE_DATE 4/12/2010 8:14:23 PM
Usingan SQL statementWhere BIB_MASTER.SUPPRESS_IN_OPAC=‘N’ will omitthe suppressedbibs.
The querythat generatedthe table is
SELECT
BIB_MASTER.BIB_ID, BIB_MASTER.LIBRARY_ID, BIB_MASTER.CREATE_DATE
INTO temp_bibmaster
FROM BIB_MASTER
WHERE bib_master.suppress_in_opac=’N’ AND bib_master.bib_id='7977843';
List of values or ‘look up tables’
The library_id inthe bib_mastertable above isa reference toatable named‘library’which
containsothervalues.There are manytablesthatfunctionaslistsof values.
An SQL queryneedstojointhe datatable and listof value table bytheircommonid inorder to
retrieve more descriptivefieldsfromlistof valuestable.
A querythatgets the libraryname fromthe librarytable thatmatcheson our sample
bibliographicrecord inthe bib_mastertable usesthe commonfieldnamedlibrary_id
SELECT
BIB_MASTER.BIB_ID, BIB_MASTER.LIBRARY_ID,
BIB_MASTER.SUPPRESS_IN_OPAC, BIB_MASTER.CREATE_DATE,
LIBRARY.LIBRARY_NAME INTO temp_bibmaster
FROM BIB_MASTER, LIBRARY
WHERE bib_master.bib_id='7977843'
AND BIB_MASTER.LIBRARY_ID=LIBRARY.LIBRARY_ID;
BIB_ID 7977843
LIBRARY_ID 7
SUPPRESS_IN_OPAC N
CREATE_DATE 4/12/2010 8:14:23 PM
LIBRARY_NAME GW
17. Voyager Reporting Basic SQL and a print monograph record 17
At thispointthree relationaldatabase tablesthatstore the MARCbibliographicdataandhave the
indexedkeyfield“bib_id”incommonhave beenidentified.
bib_master
bib_text
bib_index
Two tablescontaininglists of valuesrelatedtobibliographicdatainclude
library
bib_format
You can use the expressioncount(*) tofindouthow manyrecordsmatch the query.
Alwaysuse suppress_from_opac=’N’toeliminate suppressedbibrecordsfromqueryresults.
Example:
How manyunsuppressedbibrecordsare ownedbyGW? Approximately 1,736,000
Select count(*) as gwcounter
from bib_master
where library_id='7' AND suppress_in_opac='N';
Special function for handling Unicode in MS Access
The Accessdatabase provided byExLibris,reports.mdb,includesafunctionforhandlingUnicode
characters / diacriticsthatmay be inthe fieldstitle,title_brief,author,publisher,publish_date. The
function UTF8to16 slightlyimprovesthe results.
Select title_brief from bib_text where bib_id='11491013';
Resultsshow � characterswhere diacriticswoulddisplay
Alex Katz,prints:catalogue raisonne��,1947-2011 /
SELECT UTF8to16([TITLE_BRIEF]) AS uTITLE_BRIEF
FROM bib_text WHERE bib_id='11491013';
Resultsshow ?characters where diacriticswoulddisplay
Alex Katz,prints:catalogue raisonne??,1947-2011 /
Alternately,one canexportthe table of results,thendoasearch andreplace commandto replace �
with nulls.
19. Voyager Reporting Basic SQL and a print monograph record 19
SQL query – a specific holding record
Recall thatthe VoyagerCatalogmodule providesascreenforthe holdinginformation.Voyagerassigned
the holdinganid number,9164061, to the holdingforoursample title:
There isactuallymore data on the holdingrecord thanwhat one can see inthe screenshot.
SELECT * INTO tbl_tempholding
FROM mfhd_master
WHERE mfhd_master.mfhd_id='9164061';
MFHD_ID 9164061
LOCATION_ID 533
CALL_NO_TYPE O
NORMALIZED_CALL_NO BD 21 B 325 2010
DISPLAY_CALL_NO BD21 .B325 2010
SUPPRESS_IN_OPAC N
SOURCE_MODULE C
RECORD_STATUS n
RECORD_TYPE x
ENCODING_LEVEL 1
FIELD_007
FIELD_008 1004120u||||8|||4001uu|||0000000
CREATE_DATE 4/12/2010 8:14:26 PM
etcetera
20. Voyager Reporting Basic SQL and a print monograph record 20
SQL query – location
The location_id referencesalistof valuesinthe table namedlocation.
The holdingquerycanbe modifiedtoinclude the location name byjoiningthe mfhd_mastertable and
locationtable ontheircommonfield,location_id.
SELECT * INTO tbl_tempholding
FROMmfhd_master,location
WHERE mfhd_master.mfhd_id='9164061'
and mfhd_master.location_id=location.location_id;
Or selectedfieldsfromthe tablesmightbe preferable.Thisqueryisone version,whichusesMicrosoft
AccessSQL syntax forjoiningthe tables
SELECT mfhd_master.MFHD_ID,mfhd_master.NORMALIZED_CALL_NO,
mfhd_master.SUPPRESS_IN_OPAC,mfhd_master.CREATE_DATE,location.LOCATION_ID,
location.LOCATION_CODE,location.LOCATION_DISPLAY_NAME,location.LIBRARY_ID INTO
tbl_tempholding
FROMmfhd_masterINNERJOIN locationON mfhd_master.LOCATION_ID=location.LOCATION_ID
WHERE mfhd_master.MFHD_ID=’9164061’;
An alternate versionwhichdoesthe same thingis
SELECT mfhd_master.MFHD_ID,mfhd_master.NORMALIZED_CALL_NO,
mfhd_master.SUPPRESS_IN_OPAC,mfhd_master.CREATE_DATE,location.LOCATION_ID,
location.LOCATION_CODE,location.LOCATION_DISPLAY_NAME, location.LIBRARY_ID INTO
tbl_tempholding
FROMmfhd_master,location
WHERE mfhd_master.LOCATION_ID=location.LOCATION_ID
ANDmfhd_master.MFHD_ID=’9164061’;
MFHD_ID 9164061
NORMALIZED_CALL_NO BD 21 B 325 2010
SUPPRESS_IN_OPAC N
CREATE_DATE 4/12/2010 8:14:26 PM
LOCATION_ID 533
LOCATON_CODE gwg w
LOCATION_DISPLAY_NAME GW: GELMAN Stacks
LIBRARY_ID 7
Similartothe bibliographicrecord,aholdingmaybe suppressedfromthe onlinepubliccatalog.Usually
one wouldomitsuppressedholdingsbyaddingWHEREmfhd_master.suppress_in_opac=’N’
21. Voyager Reporting Basic SQL and a print monograph record 21
SQL query - holding record(s) associated with a bib record
In precedingpages we didanSQL queryusing the specificholding_id,9164061.
In actual practice you usuallydon’tknow inadvance how many holdingrecord(s) are associatedwitha
bibrecord,nor theirmfhd_idnumbers. Youmayhave noticedthatunfortunatelythere isnobib_idon
the holdingrecord!
Voyagerusesa table thatisspecificallydesignedtolinkdatatablestoeachother(hence the name
relational database).We need toaddthe table called bib_mfhdtoour queryinorder to jointhe bib
informationandholdinginformation.The bib_mfhdrecordhastwofields,one pointingtothe bib
informationandotherpointingtothe holdinginformation.
In our example,“Philosophy:the questfortruth and meaning “the BIB_MFHD isshownbelow.Itlists
the bib_idandthe mfhd_id.
SELECT * FROM BIB_MFHD WHERE BIB_ID='7977843';
BIB_ID MFHD_ID
7977843 9164061
The querybelow linksthe BIB_TEXTtable to the holdingtable usingBIB_MFHDas the link:
SELECT
BIB_TEXT.TITLE, MFHD_MASTER.LOCATION_ID, MFHD_MASTER.DISPLAY_CALL_NO
FROM BIB_TEXT, BIB_MFHD, MFHD_MASTER
WHERE
BIB_TEXT.BIB_ID='7977843'
AND BIB_TEXT.BIB_ID =BIB_MFHD.BIB_ID
AND BIB_MFHD.MFHD_ID=MFHD_MASTER.MFHD_ID;
TITLE LOCATION_ID DISPLAY_CALL_NO
Philosophy:the questfortruthand meaning/Andrew Beards. 533 BD21 .B325 2010
The resultabove includesthe title fromthe bibrecordalongwiththe locationidandcall numberfrom
the holdingassociatedwiththe bibrecord.The holdinginformationwasfoundusingthe connectionto
biband holdingwhichisrecordedinarecord the bib_mfhdtable.
22. Voyager Reporting Basic SQL and a print monograph record 22
SQL query – a specific item record
Recall thatthere is one holdingandone itemassociatedwithourbibrecord.The Voyagercatalogview
showedthishierarchy:
Since we knowthe item_id,we couldruna queryagainstthe itemtable toget some information:
Select ITEM_ID, PERM_LOCATION, TEMP_LOCATION2, ITEM_TYPE_ID,
HISTORICAL_CHARGES FROM ITEM WHERE ITEM_ID='5314835';
ITEM_ID 5314835
PERM_LOCATION 533
TEMP_LOCATION 0
ITEM_TYPE 3
HISTORICAL_CHARGES 0
The descriptionof the locationanditem_type canbe retrievedfromthe listof value tableslocationand
item_type.(Thisquerywascreatedusingthe graphical userinterface inMSAccess)
SELECT ITEM.ITEM_ID, ITEM.PERM_LOCATION,
LOCATION.LOCATION_DISPLAY_NAME, ITEM.TEMP_LOCATION,
ITEM.ITEM_TYPE_ID, ITEM_TYPE.ITEM_TYPE_DISPLAY,
ITEM.HISTORICAL_CHARGES
FROM
(ITEM INNER JOIN ITEM_TYPE ON ITEM.ITEM_TYPE_ID =
ITEM_TYPE.ITEM_TYPE_ID) INNER JOIN LOCATION ON ITEM.PERM_LOCATION
= LOCATION.LOCATION_ID WHERE ITEM.ITEM_ID='5314835';
Addstwofields
LOCATON.LOCATION_DISPLAY_NAME GW: GELMAN Stacks
ITEM_TYPE_DISPLAY Regularloan
2 temp_location is used for temporary locations.Eg.,the new book shelf
23. Voyager Reporting Basic SQL and a print monograph record 23
SQL query – item barcode and item status
Optionally,anitemmayhave notesorbarcode(s). (Thisquerywascreatedusingthe graphical user
interface inMS Access)
SELECT
ITEM.ITEM_ID, ITEM_BARCODE.ITEM_BARCODE, ITEM_STATUS.ITEM_STATUS,
ITEM_STATUS_TYPE.ITEM_STATUS_DESC, ITEM_STATUS.ITEM_STATUS_DATE,
ITEM_NOTE.ITEM_NOTE, ITEM_NOTE.ITEM_NOTE_TYPE
FROM
(((ITEM LEFT JOIN ITEM_BARCODE ON ITEM.ITEM_ID = ITEM_BARCODE.ITEM_ID)
LEFT JOIN ITEM_STATUS ON ITEM.ITEM_ID = ITEM_STATUS.ITEM_ID) LEFT JOIN
ITEM_STATUS_TYPE ON ITEM_STATUS.ITEM_STATUS =
ITEM_STATUS_TYPE.ITEM_STATUS_TYPE) LEFT JOIN ITEM_NOTE ON ITEM.ITEM_ID
= ITEM_NOTE.ITEM_ID
WHERE ITEM.ITEM_ID='5314835';
SQL query – item(s) associated with a holding record
If the item_idisnotknown,the itemsassociatedwithaholdingmaybe retrievedwiththisqueryhaving
the mfhd_idas selectioncriteria.(Thisquerywascreatedusingthe graphical user interface inMS
Access)
SELECT
MFHD_MASTER.MFHD_ID, MFHD_ITEM.ITEM_ID,
ITEM.PERM_LOCATION, ITEM.TEMP_LOCATION, ITEM.COPY_NUMBER,
ITEM.HISTORICAL_CHARGES
FROM
(MFHD_MASTER LEFT JOIN MFHD_ITEM ON MFHD_MASTER.MFHD_ID =
MFHD_ITEM.MFHD_ID)
LEFT JOIN ITEM ON MFHD_ITEM.ITEM_ID = ITEM.ITEM_ID
WHERE MFHD_MASTER.MFHD_ID='9164061';
SQL query – holding(s) and item(s) associated with a bib record
(Thisquerywascreatedusingthe graphical userinterface inMS Access)
SELECT BIB_MASTER.BIB_ID, BIB_MASTER.LIBRARY_ID, MFHD_MASTER.MFHD_ID,
MFHD_MASTER.LOCATION_ID, MFHD_MASTER.DISPLAY_CALL_NO,
MFHD_ITEM.ITEM_ENUM, ITEM.PERM_LOCATION, ITEM.ITEM_TYPE_ID,
BIB_TEXT.TITLE_BRIEF
FROM
BIB_TEXT INNER JOIN (((BIB_MASTER INNER JOIN BIB_MFHD ON
BIB_MASTER.BIB_ID = BIB_MFHD.BIB_ID) INNER JOIN MFHD_MASTER ON
BIB_MFHD.MFHD_ID = MFHD_MASTER.MFHD_ID) LEFT JOIN (ITEM RIGHT JOIN
MFHD_ITEM ON ITEM.ITEM_ID = MFHD_ITEM.ITEM_ID) ON MFHD_MASTER.MFHD_ID
= MFHD_ITEM.MFHD_ID) ON BIB_TEXT.BIB_ID = BIB_MASTER.BIB_ID
WHERE BIB_MASTER.BIB_ID='7977843';
24. Voyager Reporting Basic SQL and a print monograph record 24
The nextsectionof thisdocumentwill locate the financial dataassociatedwiththe sampletitle.The
tablesinthe Acquisitionsmodulestore thisdata.Recall thatourbook isshowninthisscreenshotfrom
the Acquisitionsmodule:
The Order referstothe purchase_order table. The purchase ordermay have manybooks.Each one isa
“line item”onthe purchase order(PO).
SQL query – specific purchase order by id
SELECT
PURCHASE_ORDER.PO_ID, PURCHASE_ORDER.VENDOR_ID,
PURCHASE_ORDER.PO_TYPE, PURCHASE_ORDER.PO_STATUS,
PURCHASE_ORDER.PO_STATUS_DATE, PURCHASE_ORDER.LINE_ITEM_COUNT
FROM PURCHASE_ORDER
WHERE PURCHASE_ORDER.PO_ID='146339';
25. Voyager Reporting Basic SQL and a print monograph record 25
Resultsfromthe queryforthe order id:
PO_ID VENDOR_ID PO_TYPE PO_STAUS PO_STATUS_DATE LINE_ITEM_COUNT
146339 4929 0 4 4/14/2010 4:02:10 PM 11
The VENDOR_ID,PO_TYPE, and PO_STATUSfieldsare notveryinformative since theyshow the indexed
numerickeyfortheirassociatedlistof valuestables. The nextqueryaddsthe descriptionsfromthe list
of value tables. (Thisquerywascreatedusingthe graphical userinterface inMSAccess)
SELECT
PURCHASE_ORDER.PO_ID, PURCHASE_ORDER.VENDOR_ID, VENDOR.VENDOR_CODE,
VENDOR.VENDOR_NAME, PURCHASE_ORDER.PO_TYPE, PO_TYPE.PO_TYPE_DESC,
PURCHASE_ORDER.PO_STATUS, PO_STATUS.PO_STATUS_DESC,
PURCHASE_ORDER.PO_STATUS_DATE, PURCHASE_ORDER.LINE_ITEM_COUNT,
PO_CREATE_DATE
FROM
((PURCHASE_ORDER INNER JOIN VENDOR ON PURCHASE_ORDER.VENDOR_ID =
VENDOR.VENDOR_ID) INNER JOIN PO_TYPE ON PURCHASE_ORDER.PO_TYPE =
PO_TYPE.PO_TYPE) INNER JOIN PO_STATUS ON PURCHASE_ORDER.PO_STATUS =
PO_STATUS.PO_STATUS
WHERE PURCHASE_ORDER.PO_ID='146339';
PO_ID 146339
VENDOR_ID 4929
VENDOR_CODE GWBBSAPV
VENDOR_NAME Blackwell North America Inc - APV
PO_TYPE 0
PO_TYPE_DESC Approval
PO_STATUS 4
PO_STATUS_DESC Received Complete
PO_STATUS_DATE 4/14/2010 4:02:10 PM
LINE_ITEM_COUNT 11
PO_CREATE_DATE 4/12/2010 8:14:14 PM
One can see that thiswasan approval order created4/12/2010, having11 items.
Next,let’sfindthe specificline itemassociatedwithourPhilosophytitle, bib_id7977843.
SQL Query – line items on a specific purchase order
SELECT PURCHASE_ORDER.PO_ID, LINE_ITEM.LINE_ITEM_NUMBER,
LINE_ITEM.LINE_ITEM_ID, LINE_ITEM.LINE_PRICE, LINE_ITEM.BIB_ID
FROM PURCHASE_ORDER INNER JOIN LINE_ITEM ON PURCHASE_ORDER.PO_ID =
LINE_ITEM.PO_ID
WHERE PURCHASE_ORDER.PO_ID='146339';
26. Voyager Reporting Basic SQL and a print monograph record 26
Query results
PO_ID LINE_ITEM_NUMBER LINE_ITEM_ID LINE_PRICE BIB_ID
146339 1 671125 8217 7977837
146339 2 671126 8217 7977838
146339 3 671127 4146 7977839
146339 4 671128 2486 7977840
146339 5 671129 1895 7977841
146339 6 671130 2071 7977842
146339 7 671131 1407 7977843
146339 8 671132 3316 7977844
146339 9 671133 2320 7977845
146339 10 671134 4395 7977846
146339 11 671135 2154 7977847
The queryresultabove confirmsthere isaline itemonthispurchase orderfor
the title havingbib_id7977843.
SQL Query – purchase order and line item matching a bib_id
The nextqueryselectsthe bib_id 7977843 and convertsthe fieldLINE_PRICE 1407 intocurrencyformat.
(Note:The fieldLINE_PRICEisassignedadifferentname thanitself.)
SELECT PURCHASE_ORDER.PO_ID, LINE_ITEM.LINE_ITEM_ID,
CCur([LINE_PRICE]/100) AS LPRICE, LINE_ITEM.BIB_ID
FROM PURCHASE_ORDER INNER JOIN LINE_ITEM ON PURCHASE_ORDER.PO_ID =
LINE_ITEM.PO_ID
WHERE PURCHASE_ORDER.PO_ID='146339' AND LINE_ITEM.BIB_ID='7977843';
In fact,since the PO numberisalreadyonthe line_itemtable,one wouldn’tnecessarilyneedtojointhe
line_itemandpurchase_ordertable unlessfieldsfromthe POneedtobe part of the results.Thisquery
checkonlythe line_itemtable foramatch onthe bib_id.
SELECT LINE_ITEM.LINE_ITEM_ID, CCur([LINE_PRICE]/100) AS LPRICE,
LINE_ITEM.BIB_ID
FROM LINE_ITEM
WHERE LINE_ITEM.BIB_ID='7977843';
LINE_ITEM_ID LPRICE BIB_ID
671131 $14.07 7977843
The queryresultabove showsthat,accordingto the purchase order,the price of the itemis$14.07 –
howeveritisbestto checkthe invoice forthe price.
27. Voyager Reporting Basic SQL and a print monograph record 27
SQL query – invoice line item price for a given bib_id
SELECT
LINE_ITEM.LINE_ITEM_ID,
CCur([LINE_ITEM.LINE_PRICE]/100) AS PO_PRICE,
LINE_ITEM.BIB_ID,
INVOICE_LINE_ITEM.INV_LINE_ITEM_ID,
INVOICE_LINE_ITEM.INVOICE_ID,
CCur([INVOICE_LINE_ITEM].[LINE_PRICE]/100) AS INVOICE_PRICE
FROM
LINE_ITEM INNER JOIN INVOICE_LINE_ITEM ON LINE_ITEM.LINE_ITEM_ID =
INVOICE_LINE_ITEM.LINE_ITEM_ID
WHERE LINE_ITEM.BIB_ID='7977843';
LINE_ITEM_ID 671131
PO_PRICE $14.07
BIB_ID 7977843
INV_LINE_ITEM_ID 828252
INVOICE_ID 138455
INVOICE_PRICE $14.07
The queryresultsindicate thatthe bookwasinvoicedforthe same amountas the purchase orderprice.
The nextlogical stepisto findoutwhatfundswere charged.
SQL query – invoice line item and fund/ledger for a given bib_id
For thisquery,the tablesnamed fundandledgercouldbe usedseparately,howeveraconvenient
‘view’table, fund_ledger_vw, simplifiesthe numberof joinsthatwouldbe required. First,itis
necessarytojointhe invoice line itemtothe linkingtable, invoice_line_item_funds.
SELECT
LINE_ITEM.LINE_ITEM_ID,
CCur([LINE_ITEM.LINE_PRICE]/100) AS PO_PRICE,
LINE_ITEM.BIB_ID,
INVOICE_LINE_ITEM.INV_LINE_ITEM_ID,
INVOICE_LINE_ITEM.INVOICE_ID,
CCur([INVOICE_LINE_ITEM].[LINE_PRICE]/100) AS INVOICE_PRICE,
INVOICE_LINE_ITEM_FUNDS.LEDGER_ID,
INVOICE_LINE_ITEM_FUNDS.FUND_ID
FROM (LINE_ITEM INNER JOIN INVOICE_LINE_ITEM ON LINE_ITEM.LINE_ITEM_ID
= INVOICE_LINE_ITEM.LINE_ITEM_ID) INNER JOIN INVOICE_LINE_ITEM_FUNDS
ON INVOICE_LINE_ITEM.INV_LINE_ITEM_ID =
INVOICE_LINE_ITEM_FUNDS.INV_LINE_ITEM_ID
WHERE LINE_ITEM.BIB_ID='7977843';
Two fieldsare added. LEDGER_ID=335 and FUND_ID=13640
Well,those are justids – the detailsare inthe fundledger view.The nextqueyaddsthattable.
28. Voyager Reporting Basic SQL and a print monograph record 28
SQL query – price, fund, and ledger from an invoice for a specific bib_id
(Thisquerywascreatedusingthe graphical userinterface inMS Access)
In thisquery,the fundname,ledgername,fiscal periodname have been added.These fieldsare onthe
fund_ledger_vw table.The queryjoinsthe table bybothfund_idandledger_id .Several idnumbers
fromthe previousqueryare omittedinlieuof theirdescriptions
SELECT
LINE_ITEM.BIB_ID,
INVOICE_LINE_ITEM.INVOICE_ID,
CCur([INVOICE_LINE_ITEM].[LINE_PRICE]/100) AS INVOICE_PRICE,
FUNDLEDGER_VW.LEDGER_NAME,
FUNDLEDGER_VW.FUND_NAME,
FUNDLEDGER_VW.FISCAL_PERIOD_NAME
FROM ((LINE_ITEM INNER JOIN INVOICE_LINE_ITEM ON
LINE_ITEM.LINE_ITEM_ID = INVOICE_LINE_ITEM.LINE_ITEM_ID) INNER JOIN
INVOICE_LINE_ITEM_FUNDS ON INVOICE_LINE_ITEM.INV_LINE_ITEM_ID =
INVOICE_LINE_ITEM_FUNDS.INV_LINE_ITEM_ID) INNER JOIN FUNDLEDGER_VW ON
(INVOICE_LINE_ITEM_FUNDS.FUND_ID = FUNDLEDGER_VW.FUND_ID) AND
(INVOICE_LINE_ITEM_FUNDS.LEDGER_ID = FUNDLEDGER_VW.LEDGER_ID)
WHERE LINE_ITEM.BIB_ID='7977843';
BIB_ID 7977843
INVOICE_ID 138455
INVOICE_PRICE $14.07
LEDGER_NAME gwgel2010103206
FUND_NAME 10320658611Approvals
FICAL_PERIOD_NAME GW 2009/2010
The last queryonthe nextpage will putall of the tablestogethertogeta report onbib_id7977843
NOTES
Because the queryisfor a bib_idwe know has beeninvoicedandprocessed,noleftjoinswereused
inthe queryforsimplicity.Inactual practice,manyleftjoinswouldbe usedtocompensate for
situationswhere the optional dataisn’tpresent.
o For example if anitemhadnotyetbeenbarcoded,the whole querywouldreturnnoresult!
A full explanationof the tablesassociatedwiththe Acquisitionsmoduleisoutsidethe scope of this
document.
29. Voyager Reporting Basic SQL and a print monograph record 29
SQL Query summary profile of a bib_id print holding with one item
(Thisquerywascreated usingthe graphical userinterface inMS Access)
SELECT
BIB_TEXT.TITLE_BRIEF, BIB_TEXT.AUTHOR, BIB_TEXT.ISBN,
LINE_ITEM.BIB_ID,
LOCATION.LOCATION_DISPLAY_NAME,
ITEM_BARCODE.ITEM_BARCODE,
MFHD_MASTER.DISPLAY_CALL_NO,
ITEM.HISTORICAL_CHARGES AS CHGHIST,
ITEM_STATUS_TYPE.ITEM_STATUS_DESC,
ITEM_TYPE.ITEM_TYPE_DISPLAY,
CCur([INVOICE_LINE_ITEM].[LINE_PRICE]/100) AS INVOICE_PRICE,
FUNDLEDGER_VW.LEDGER_NAME, FUNDLEDGER_VW.FUND_NAME,
FUNDLEDGER_VW.FISCAL_PERIOD_NAME
FROM ((((((((((((LINE_ITEM INNER JOIN INVOICE_LINE_ITEM ON
LINE_ITEM.LINE_ITEM_ID = INVOICE_LINE_ITEM.LINE_ITEM_ID) INNER JOIN
INVOICE_LINE_ITEM_FUNDS ON INVOICE_LINE_ITEM.INV_LINE_ITEM_ID =
INVOICE_LINE_ITEM_FUNDS.INV_LINE_ITEM_ID) INNER JOIN FUNDLEDGER_VW ON
(INVOICE_LINE_ITEM_FUNDS.FUND_ID = FUNDLEDGER_VW.FUND_ID) AND
(INVOICE_LINE_ITEM_FUNDS.LEDGER_ID = FUNDLEDGER_VW.LEDGER_ID)) INNER
JOIN BIB_TEXT ON LINE_ITEM.BIB_ID = BIB_TEXT.BIB_ID) INNER JOIN
BIB_ITEM ON BIB_TEXT.BIB_ID = BIB_ITEM.BIB_ID) INNER JOIN ITEM ON
BIB_ITEM.ITEM_ID = ITEM.ITEM_ID) INNER JOIN ITEM_STATUS ON
ITEM.ITEM_ID = ITEM_STATUS.ITEM_ID) INNER JOIN ITEM_TYPE ON
ITEM.ITEM_TYPE_ID = ITEM_TYPE.ITEM_TYPE_ID) INNER JOIN LOCATION ON
ITEM.PERM_LOCATION = LOCATION.LOCATION_ID) INNER JOIN ITEM_STATUS_TYPE
ON ITEM_STATUS.ITEM_STATUS = ITEM_STATUS_TYPE.ITEM_STATUS_TYPE) INNER
JOIN ITEM_BARCODE ON ITEM.ITEM_ID = ITEM_BARCODE.ITEM_ID) INNER JOIN
BIB_MFHD ON (BIB_TEXT.BIB_ID = BIB_MFHD.BIB_ID) AND (BIB_TEXT.BIB_ID =
BIB_MFHD.BIB_ID)) INNER JOIN MFHD_MASTER ON BIB_MFHD.MFHD_ID =
MFHD_MASTER.MFHD_ID
WHERE LINE_ITEM.BIB_ID='7977843';
TITLE_BRIEF Philosophy:the questfortruthand meaning/
AUTHOR Beards,Andrew.
ISBN 9780814654743
BIB_ID 7977843
LOCATION_DISPLAY_NAME GW: GELMAN Stacks
ITEM_BARCODE 32882019588535
DISPLAY_CALL_NO BD21 .B325 2010
CHGHIST 0
ITEM_STATUS_DESC NotCharged
ITEM_TYPE_DISPLAY Regularloan
INVOICE_PRICE $14.07
LEDGER_NAME gwgel2010103206
FUND_NAME 10320658611Approvals
FISCAL_PERIOD_NAME GW 2009/2010