Download presentation
Presentation is loading. Please wait.
Published byAshley Logan Modified over 9 years ago
1
Querying Databases A query is a program that allows us to VIEW the data or operate on the data Several types of queries –Select query –Merge query –Summary query –Crosstab query –Action query
2
Simple Select Query Go into query wizard –select table (or other query) where data reside –select desired fields –Next, then make sure button is on detail –Next, then name query –Finish – can open in design or datasheet view
3
Simple Select Query In design view, you can –Change order of fields by dragging –sort data by selected fields –decide which fields to show –assign criteria to select records type in value –numbers can just be entered –text needs to be enclosed in double quotes –dates need to be enclosed by # can build simple expressions –between, <>
4
Simple Select Query Use expression builder Example – select species =7 add length>100
5
Expression Builder Adds ability to create new variables, select by criteria Mathematical and Logical Operators –add, subtract, multiply, divide –=, >, not equal –And, Or, Not, –Like – string operator can use wildcards *, ?
6
Expression Builder And, Or, Not Logic –And: both or all conditions need to be true –Or: one or both conditions need to be true –Not: the expression must be false to be selected
7
Expression Builder Lots of functions available – thus can build up almost any formula you can imagine to create CALCULATED FIELDS We won’t go much into this – very specific for situation you are dealing with –Short example, converting length in mm to length in inches Go into field name and hit expression builder Put in field name followed by colon, then enter formula. Note – for some reason, Access will try to put in >, but this needs to be deleted
8
Select Query from Multiple Tables This is what I call a MERGE query Important note: if tables have not been connected in relationship window, you WILL run into problems. This will create a new table with every record in both tables being combined –Query Wizard won’t let you do this, but design view will Start in Query Wizard Basically looks the same as select query from a single table (except note that tables will show as linked in window in design view)
9
Select Query from Multiple Tables If you’ve properly defined relationships, performing merges is simple in Access. This is a good way to “test” your table relationships because if it is not properly defined, the merge will give you “incorrect” results
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.