1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.
-
Upload
milo-walker -
Category
Documents
-
view
220 -
download
0
Transcript of 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.
![Page 1: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/1.jpg)
1
A Trio of Topics for Confident Access Query Writers
ELSUGOctober 8, 2009
Cathy SalikaCARLI
![Page 2: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/2.jpg)
2
Three BIG Topics
Outer Joins
The BLOB Functions
Make Table Queries & Subqueries
![Page 3: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/3.jpg)
3
Outer Joins
Most sources call them “outer joins”.
Access calls them “left joins” and “right joins”.
The distinction turns out to be not very helpful, at least to me.
![Page 4: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/4.jpg)
4
Two reasons to use an outer join:
1) In case there are no matching data in a table you’re linking to
2) To find records that don’t have matching data in a table you’re linking to
![Page 5: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/5.jpg)
5
In case there are no data in a table you’re linking to...What could go wrong with this query?
![Page 6: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/6.jpg)
6
ITEMITEM_ID PRICE
1 $15.00
2 $180.69
ITEM_ID ITEM_BARCODE
1 309991234
3 309996789
ITEM_BARCODE
The normal join on ITEM_ID will give you just one record.
ITEM_ID PRICE ITEM_BARCODE
1 $15.00
309991234
Remember, you have to have matching ITEM_IDs in both tables to get a record.
![Page 7: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/7.jpg)
7
So what could go wrong with this query?
Items with no barcode will not appear.
MFHDs with no item will not appear.
![Page 8: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/8.jpg)
8
Think of some other examples where you might link to a table in which matching data might be missing.
A list of patrons, some of whom might not have barcodes
A list of purchase orders, some of which might not have invoices yet.
A list of items, some of which might not have statistical categories.
Others?
![Page 9: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/9.jpg)
9
ITEMITEM_ID PRICE
1 $15.00
2 $180.69
ITEM_ID ITEM_BARCODE
1 309991234
3 309996789
ITEM_BARCODE
ITEM_ID PRICE ITEM_BARCODE
1 $15.00 309991234
2 $180.69
<Null>
How do we fix this? We change the join.
![Page 10: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/10.jpg)
10
How’d she do that?
Right-click on the link...
... and select Join Properties
![Page 11: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/11.jpg)
11
You get this...
![Page 12: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/12.jpg)
12
Pick option 2, click OK, and the link turns into an arrow.
So what if I had picked option 3 instead?
![Page 13: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/13.jpg)
13
The arrow would be pointing the other way.
This is the “left” and “right” aspect of joining, but since this...
... is just the same as the picture above, I don’t find “left” and “right” very helpful.
![Page 14: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/14.jpg)
14
But it matters which table the arrow is pointing to!
A LOT!!!
![Page 15: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/15.jpg)
15
ITEMITEM_ID PRICE
1 $15.00
2 $180.69
ITEM_ID ITEM_BARCODE
1 309991234
3 309996789
ITEM_BARCODE
ITEM_ID PRICE ITEM_BARCODE
1 $15.00 309991234
2 $180.69
<Null>
ITEM_ID PRICE ITEM_BARCODE
1 $15.00 309991234
3 <Null> 309996789
![Page 16: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/16.jpg)
16
A list of items, some of which might not have statistical categories.
![Page 17: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/17.jpg)
17
Moral: All the links beyond the arrow have to be arrows too.
![Page 18: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/18.jpg)
18
A list of patrons, some of whom might not have barcodes
![Page 19: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/19.jpg)
19
Two reasons to use an outer join:
1) In case there are no matching data in a table you’re linking to
2) To find records that don’t have matching data in the table you’re linking to
![Page 20: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/20.jpg)
20
Suppose I want to find...
... the items that have no barcodes
... the bibs that have no holdings
... the patrons who have no barcodes
Use an outer join and check for the <Null> value.
The criterion is: Is Null
![Page 21: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/21.jpg)
21
Items with no barcodes
![Page 22: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/22.jpg)
22
Bibs with no holdings
![Page 23: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/23.jpg)
23
Patrons with no barcodes
![Page 24: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/24.jpg)
24
Any outer join questions?
![Page 25: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/25.jpg)
25
What can you do now that you couldn’t do before you learned about outer joins?
![Page 26: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/26.jpg)
26
Next topic: The BLOB Functions
![Page 27: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/27.jpg)
27
Voyager stores catalog data in two ways:
Frequently used data are in their own fields.
Things like TITLE, AUTHOR, DISPLAY_CALL_NO
Fields that need to be indexed
Fields in multi-bib displays
The whole MARC record is stored as a Binary Large OBject.
The BLOB functions let you get at any piece of a MARC record.
![Page 28: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/28.jpg)
28
The BLOB functions are indispensable, but they’re slow, so
Remember the Alternatives!
![Page 29: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/29.jpg)
29
Alternatives to the BLOB Queries
For common fields, try BIB_TEXT
For fields in left-anchored indexes, try BIB_INDEX
For fixed fields, try MARC*_VW (e.g. MARCBOOK_VW)
For URLs, try ELINK_INDEX
![Page 30: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/30.jpg)
30
BIB_TEXT p. 11, 14, 27, 33, 36The starred fields in this table are in UTF-8.If you need data from a bib record that are not available in BIB_TEXT, check to see if
they arein BIB_INDEX. Using BIB_INDEX and BIB_TEXT is more efficient than using the BLOB
functions.If you’re thinking of using begin_pub_date in a criterion, consider using the indexed
version of this field. It’s in the BIB_INDEX table, in the normal_heading field when
index_code=008D.<snip>Here’s how MARC tags map to fields in BIB_TEXT:Leader byte 5 record_statusLeader bytes 6-7 bib_formatLeader byte 17 encoding_level<snip>020 a isbn022 a issn024 a other_std_num027 a stdtech<snip>100 abcdkq author110 abcdgkn author111 acdegkn author245 abcfghknps title245 ab title_brief130 adfgklmnoprs uniform_title
![Page 31: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/31.jpg)
31
There are just 7 BLOB functions to learn
GetAuthBlob
GetBibBlob
GetMFHDBlob
GetField GetFieldAll GetFieldRaw
GetSubField
![Page 32: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/32.jpg)
32
GetAuthBlob(auth_id)
GetBibBlob(bib_id)
GetMFHDBlob(mfhd_id)
These three aren’t useful on their own. They ask Voyager for a MARC record. You use one of these as a building block for the other functions.
![Page 33: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/33.jpg)
33
Your query should include at least one table in which the ID field is unique, for example:
GetBibBlob([BIB_TEXT].[BIB_ID])
GetBibBlob([BIB_MASTER].[BIB_ID])
GetAuthBlob([AUTH_MASTER].[AUTH_ID])
GetMFHDBlob([MFHD_MASTER].[MFHD_ID])
BTW, capitalization doesn’t matter.
![Page 34: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/34.jpg)
34
You’ll wrap one of these
GetField
GetFieldAll
GetFieldRaw
around one of these
GetAuthBlob
GetBibBlob
GetMFHDBlob
![Page 35: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/35.jpg)
35
GetField gives you a single occurrence of a MARC field
Syntax:
GetField(
One of the Blob functions
,A MARC tag
, Which one? )
Example: the first 505 field in a bib record
GetField(GetBibBlob([BIB_TEXT].[BIB_ID]),’505’,1)
Example: the first subject (6xx field) in a bib record:
GetField(GetBibBlob([BIB_TEXT].[BIB_ID]),’6’,1)
![Page 36: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/36.jpg)
36
Example: the first 505 field in a bib record
GetField(GetBibBlob([BIB_TEXT].[BIB_ID]),’505’,1)
v. 1. Ancient Egypt through the Middle Ages -- v. 2. The Renaissance to the present.
Example: the first subject (6xx field) in a bib record:
GetField(GetBibBlob([BIB_TEXT].[BIB_ID]),’6’,1)
Latin poetry, Medieval and modern History and criticism
![Page 37: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/37.jpg)
37
A Blob Function in a Query
![Page 38: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/38.jpg)
38
Using Shift-F2 to Zoom
![Page 39: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/39.jpg)
39
Zoom works with criteria too.
You can resize the font to improve readability.
![Page 40: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/40.jpg)
40
GetFieldAll gives you all occurrences of a MARC field
Syntax:
GetFieldAll(
One of the Blob functions
,A MARC tag
)
Example: all of the 650 fields in a bib record
GetFieldAll(GetBibBlob([BIB_TEXT].[BIB_ID]),’650’)
Example: all of the 866s in a MFHD:
GetFieldAll(GetMFHDBlob([MFHD_ID]),’866’)
![Page 41: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/41.jpg)
41
Example: all of the 650 fields in a bib record
GetFieldAll(GetBibBlob([BIB_TEXT].[BIB_ID]),’650’)
Job enrichment
Employees' representation in management
Personnel management
You might have to make the rows in Access taller to see them all, because they all appear in one cell.
![Page 42: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/42.jpg)
42
Example: all of the 866s in a MFHD:
GetFieldAll(GetMFHDBlob([MFHD_MASTER].[MFHD_ID]),’866’)
0 no.1 (1958)-no. 6 (1962)
0 no. 8 (1964)-no. 11 (1966)
0 no. 16 (1968)-no. 18 (1973-1975)
![Page 43: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/43.jpg)
43
“Advanced Features” for GetField and GetFieldAll
You may add 2 more parameters to these functions
* a list of subfields that you want to see
* a separator to appear between subfields
![Page 44: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/44.jpg)
44
GetField(GetBibBlob([BIB_TEXT].[BIB_ID]),”650”)Forensic psychiatry Illinois Bloomington Case
studies.
Example: the first 650 field, subfields a and xGetField(GetBibBlob([BIB_TEXT].[BIB_ID]),”650”,1,”ax”)
Forensic psychiatry Case studies.
Example: the first 650 field, subfields a, x and z with double dashes between subfields
GetField(GetBibBlob([BIB_TEXT].[BIB_ID]),”650”,1,”axz”,”--”)
Forensic psychiatry--Case studies--Illinois--Bloomington.
![Page 45: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/45.jpg)
45
GetFieldRaw give you one occurrence of a MARC field, including the tag, indicators, and subfield coding.
* It’s the only way to get the indicators.
* It’s the only function that works with GetSubField.
Syntax:
GetFieldRaw(
One of the Blob functions
,A MARC tag
Which one?
),
Example: the third 650 field in a bib record:
GetFieldRaw(GetBibBlob([BIB_TEXT].[BIB_ID]),’650’,3)
![Page 46: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/46.jpg)
46
Example: the third 650 field in a bib record:
GetFieldRaw(GetBibBlob([BIB_TEXT].[BIB_ID]),’650’,3)
650 0aDay care centersxGovernment policyzUnited States.
![Page 47: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/47.jpg)
47
245: getfieldraw(getbibblob([bib_text].[bib_id]),'245',1)
Ind1: Mid(getfieldraw(getbibblob([bib_text].[bib_id]),'245',1),4,1)
Ind2: Mid(getfieldraw(getbibblob([bib_text].[bib_id]),'245',1),5,1)
Use the Mid function to isolate the indicators.
![Page 48: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/48.jpg)
48
Ind1: Mid(getfieldraw(getbibblob([bib_text].[bib_id]),'245',1),4,1)
Ind2: Mid(getfieldraw(getbibblob([bib_text].[bib_id]),'245',1),5,1)
245: getfieldraw(getbibblob([bib_text].[bib_id]),'245',1)
![Page 49: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/49.jpg)
49
GetSubField gives you one occurrence of a MARC subfield.
You need GetFieldRaw and a Blob function with it.
Syntax:
GetSubField(GetFieldRaw(~etc~),
A MARC subfield code
, Which one?
)
![Page 50: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/50.jpg)
50
Example: The second $x from the first 650 in a bib record
GetSubField(GetFieldRaw(GetBibBlob([BIB_TEXT].[BIB_ID]),’650’,1),’x’,2)
Bibliography.
![Page 51: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/51.jpg)
51
The Blob functions can be slow, especially for large databases.
Avoid putting a criterion on a BLOB function.
Try to use the BLOB functions on a subset of your data.
![Page 52: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/52.jpg)
52
To sum up:
GetAuthBlob
GetBibBlob
GetMFHDBlob
GetField GetFieldAll GetFieldRaw
GetSubField
![Page 53: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/53.jpg)
53
Questions about the BLOB?
![Page 54: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/54.jpg)
54
What can you do now that you couldn’t do before you learned the BLOB?
![Page 55: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/55.jpg)
55
Make Table Queries and Subqueries: It’s an Art
![Page 56: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/56.jpg)
56
Make Table Queries and Subqueries fill the same need in different ways.
We’ll focus on Make Table Queries first.
![Page 57: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/57.jpg)
57
If you ever say to yourself...
“I know how to write this query, except that one of the tables I need doesn’t exist,”
...you need a Make Table Query.
![Page 58: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/58.jpg)
58
Example: List all the patron barcodes that appear more than once in my database and show who they’re assigned to.
It’d be pretty easy if you had this table, right?
Patron_Barcode Num_Occurrences
20999000012300
2
20999000076500
3
20999000034500
2
![Page 59: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/59.jpg)
59
So write a query that builds the table:
![Page 60: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/60.jpg)
60
To save the table in your Access database, you need to make it into a Make Table query:
![Page 61: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/61.jpg)
61
Then Access asks what the table should be called.
![Page 62: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/62.jpg)
62
I’ll call it
“Dup Patron Barcode Table”
Tip: You can’t have a table and a query with the same name. If you do, you get an obscure error message. To keep this from happening, I usually include “table” in my table names.
When the query completes, you’ll get this message:
![Page 63: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/63.jpg)
63
If you run the query a second time, Access will delete the results of the previous run, but it will ask you first:
![Page 64: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/64.jpg)
64
Now, when I look at the tables I have available...
![Page 65: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/65.jpg)
65
And when I open it…
![Page 66: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/66.jpg)
66
List all the patron barcodes that appear more than once in my database. That’s easy now!
![Page 67: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/67.jpg)
67
Another example: I want a list of the items that are both charged out and damaged.
That would be easy if I had a table listing the charged items and a table listing the damaged ones.
![Page 68: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/68.jpg)
68
A table of the charged items:
![Page 69: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/69.jpg)
69
A table of the damaged items:
![Page 70: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/70.jpg)
70
And a query to find the items in both:
![Page 71: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/71.jpg)
71
Another use for a Make Table query:
If you have a Blob query that you know will run for a long time, make it a Make Table query.
Start it before you leave work for the day.
I lock my workstation and tape a note to the power button saying that it’s locked.
With luck, in the morning, it will be ready to paste my results into the table.
![Page 72: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/72.jpg)
72
Make Table Query Subquery
Saves the results in your Access database
Doesn’t save the intermediate results
Makes your Access database get bigger
Doesn’t take up room in your Access database
It’s easy to look at the results before you go on to the next step.
You have to make a point of checking your results.
The results can be used by more than one query.
The subquery can be used by more than one query, but it is re-run each time.
Sometimes it’s handy to break up a long-running query into steps.
Sometimes it’s handy to run the whole thing in one step.
![Page 73: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/73.jpg)
73
Subquery example: patron barcodes that appear more than once in my database.
Write the subquery.
Don’t make it a Make Table query.
Don’t run it (except to examine and verify the results).
Save it.
![Page 74: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/74.jpg)
74
![Page 75: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/75.jpg)
75
When I’m about to select the tables for the main query, click the Queries tab and select “Dup patron barcodes subquery”.
![Page 76: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/76.jpg)
76
Then click the Tables tab and select the other tables that you need.
![Page 77: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/77.jpg)
77
Add the links, save the query, and run it.
![Page 78: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/78.jpg)
78
Questions about Make Table queries and subqueries?
![Page 79: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/79.jpg)
79
What can you do now that you know about Subqueries and Make Table Queries?
![Page 80: 1 A Trio of Topics for Confident Access Query Writers ELSUG October 8, 2009 Cathy Salika CARLI.](https://reader030.fdocuments.in/reader030/viewer/2022033105/56649f1e5503460f94c359ff/html5/thumbnails/80.jpg)
80
It’s been a whirlwind tour!
Thank you!