Presentation is loading. Please wait.

Presentation is loading. Please wait.

Query in Microsoft Access. Lesson plan Expression in Microsoft Access Create a query.

Similar presentations


Presentation on theme: "Query in Microsoft Access. Lesson plan Expression in Microsoft Access Create a query."— Presentation transcript:

1 Query in Microsoft Access

2 Lesson plan Expression in Microsoft Access Create a query

3 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)

4 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

5 Expression in Microsoft Access Algebraic/Arithmetic Expressions : Example:

6 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

7 Expression in Microsoft Access Example:

8 Expression in Microsoft Access Boolean Expressions : Boolean operators: andlogical AND orlogical OR NOTLogical NOT XorExclusive OR

9 Expression in Microsoft Access Example

10 Expression in Microsoft Access Other operators: Is:Example: Is null In: determine whether a string value is a member of a list of values Like: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.gbetween 1 and 7

11 Expression in Microsoft Access Example

12 Expression in Microsoft Access Functions: Math String (Text manipulation) Financial Data & time

13 Expression in Microsoft Access

14 Query in Microsoft Access Is 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

15 Query in Microsoft Access Example: Create a query using Query design window Query -> Query by Design View

16 Query in Microsoft Access Select tables being included in a query Select fields being included in a query Specify the criteria

17 Query in Microsoft Access Sorting the display

18 Query in Microsoft Access Preventing updates to the query result set Why needed?: preventing users from updating the results of the queries

19 Query in Microsoft Access Types 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

20 Action queries Create Query by Design View -> Right click mouse

21 Action queries

22 Parameter queries

23

24 Queries – Practice Please try the first 11 queries in project 1 part 3. If done, please try queries from 12-14

25 Crosstab queries Join tables Create Crosstable queries

26 Join tables –How to join multiple tables Identify relationships among tables Four types of joins: –Equi-joins –Outer joins –Self-joins –Theta joins

27 Equi-joins (inner joins) –Display all the records in one table that have corresponding records in another table Example:

28 Equi-joins (inner joins)

29

30 ….

31 Designing Nested Queries Establish the relationship between a query and a table

32 Designing Nested Queries Establish the relationship between a query and a table

33 Designing Nested Queries

34

35

36 Outer joins Display records in one member of the join, regardless of whether corresponding records exist on the other side of the join

37 Outer joins

38 Self joins Display rows for which values of two columns in the same table are equal

39 Theta joins Relate data by using NOT equal comparison rather than equal comparison

40 Theta joins Relate data by using NOT equal comparison rather than equal comparison

41 Practice Try queries 10-20 in the project part 3


Download ppt "Query in Microsoft Access. Lesson plan Expression in Microsoft Access Create a query."

Similar presentations


Ads by Google