query in microsoft access. lesson plan expression in microsoft access create a query
Post on 20-Dec-2015
240 views
TRANSCRIPT
Expression in Microsoft Access
• An expression is a combination of – data fields, operators, values, and/or
functions
• Data fields: column names/attribute names that are put inside[ ] such as [Price]
• Values: number (Int, Double), date…
• Functions: Math (e.g abs), String(len)
Expression in Microsoft Access
Algebraic/Arithmetic Expressions :
Contains arithmetic operators:
+ add
- Subtract
* Multiplication
/ Division
Mod: modulo
^ raise to a power
\ divide one integer by another
Expression in Microsoft Access
Boolean Expressions :
Contains comparison/relational and/or boolean operators:
Comparison operators:
< less than
<= less than or equal to
= equal to
<> Not equal to
> Greater
>= Greater than or equal to
Expression in Microsoft Access
Boolean Expressions :
Boolean operators:
and logical AND
or logical OR
NOT Logical NOT
Xor Exclusive OR
Expression in Microsoft Access
Other operators:
Is: Example: Is nullIn: determine whether a string value is a
member of a list of valuesLike: determine whether a string value
begins with one or more characters, use with * or ?
E.g [firstname] like “Jon*”Between: determine whether a numeric or
date value lies within a specific range of values
E.g between 1 and 7
Query in Microsoft AccessIs used to select a group of records that meet
the criteria a user specifies (VIEW)
Combine information from different tables and provide a unified view of related items
Query in Microsoft AccessExample: Create a query using Query design
window
Query -> Query by Design View
Query in Microsoft AccessSelect tables being included in a query
Select fields being included in a query
Specify the criteria
Query in Microsoft AccessPreventing updates to the query result set
Why needed?: preventing users from updating the results of the queries
Query in Microsoft AccessTypes of queries
• Select: as shown in previous slides• Action: such as create a table, delete,
update• Parameter: repeatedly use a query and
make only a simple changes to its criteria• Crosstab: summarize data from one or
more tables in the form of spreadsheet
Queries – Practice
• Please try the first 11 queries in project 1 part 3.
• If done, please try queries from 12-14
Join tables
– How to join multiple tables• Identify relationships among tables • Four types of joins:
– Equi-joins– Outer joins– Self-joins– Theta joins
Equi-joins (inner joins)
– Display all the records in one table that have corresponding records in another table
Example:
Outer joins
Display records in one member of the join, regardless of whether corresponding records exist on the other side of the join