32
FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

FIS 318/618: Financial Systems & DatabasesQueries

Oakland UniversitySchool of Business Administration

Accounting and FinanceJoe Callaghan

Page 2: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Query Types

• Select

• Crosstab

• Make-Table

• Update

• Append

• Delete– Parameter-driven

Page 3: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.1 Access data types.

Data Type Description and Use Text Holds up to 255 characters consisting of anything you can type on the

keyboard. Data cannot be used in calculations.

Memo Lengthy, variable-length text and numbers for comments or explanations. A memo field can contain up to 65,535 characters.

Number Numeric data used in calculations. Set the Field Size property to define the specific number type including byte, integer, long integer, single, double, replication ID, and decimal.

Date/Time Holds date or time information. Several formats are available, or you can establish a custom format.

Currency Holds monetary data of up to 19 significant digits (15 to the left of the decimal point and 4 to the right). Currency fields are formatted to display a currency symbol and two decimal places. Use currency to avoid rounding errors in financial calculations.

AutoNumber A unique sequential number that Access automatically generates. This data type is often used for primary keys, because it guarantees unique values.

Yes/No Yes/No, True/False, or On/Off are all examples of legitimate field values. Choose the Yes/No data type when only two values are possible (gender or invoice paid, for example).

OLE Object Contains objects from another Windows application such as a picture, graph, or spreadsheet. When you double-click an OLE object, the program that created the object is launched so you can modify or view the OLE object.

Hyperlink Text or combinations of text and numbers constituting a World Wide Web hyperlink address.

Lookup Wizard A field that provides the mechanism to automatically lookup a value from another table or list of fields by using a combo box or list box control.

Page 4: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.2 Example form.

Page 5: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.3 Example report.

Page 6: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.4 Viewing a database record with Internet Explorer.

record from the database

Pages collection is open

record navigation toolbar

shortcut to data access page

Page 7: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.5 Separating tables from other database objects.

Table.mdbone database contains only tables

Accounting.mdb

a separate database contains queries, forms, and other objects

these are links to tables in Table.mdb

Page 8: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.6 Defining a table's structure and saving it.

indicates the field is the table's primary key

enter table's new name here

field descriptions

Field Properties panel

data types

Page 9: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.7 Contents of the example customer table, tblMyCustomer.

CustomerID CompanyName PhoneNumber LastContactDate CreditLimit 3101 Experience Coffee 555-1233 5/23/2004 4000 3122 Gourmet Grinder 555-7826 9/14/2003 1000 3245 La Jolla Expresso 555-3919 7/9/2004 5500 3658 Starbucks Coffee 555-5561 9/14/2003 15000 3702 Kensington Coffee Company 555-6153 12/16/2003 1000 3824 Intermezzo Espresso Bar 555-8282 8/5/2004 7500 3961 Just Bean Counters 555-9646 3/15/2004 2500

Page 10: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.8 Show Table dialog box.

Tables tab

tables in the database

Relationships window

Page 11: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.9 Establishing a link between related tables.

the mouse pointer changes shape when you drag a field from one table field list to another

click and drag the DivisionID field to the foreign key in tblEmployee

Page 12: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.10 Enforcing Referential Integrity.

primary key field name from tblDivisionLocation

foreign key field name from tblEmployee

Enforce Referential Integrity check box

Page 13: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.11 A join line connects two tables.

primary key field

foreign key field

join line

Page 14: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.12 Clicking the expand indicator reveals related records.

expand indicators

subdatasheet

Page 15: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.13 Setting tblEmployee field properties.

Validation Text property

Caption property

Default Value property

Format property

Decimal Places property

Validation Rule property

Page 16: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.14 Relationships among tables.

Page 17: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.15 Some rows of the tblInventoryDescription table.

the table's primary key a foreign key

Page 18: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.16 One-table query definition and dynaset.

dynaset

query definition

Page 19: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.17 Query with multiple, independent criteria.

dynaset

independent criteria are on separate rows

query definition (Design view)

Page 20: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.18 Column Width dialog box.

click to set column(s) to a standard width

manually set column width

click to select optimal fit

Page 21: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.19 Comparison operators.

Operator Meaning< Less than<= Less than or equal to> Greater than>= Greater than or equal to= Equal to<> Not equal toBetween Test for a range of values where two extreme values are separated by

the And operatorIn Test for “equal to” any member in a listLike Test a text or memo field to match a pattern string

Page 22: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.20 Two-table query using a comparison operator.

query design

dynaset

Page 23: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.21 LIKE wildcard characters.

WildcardCharacter Meaning Example Pattern Matches? Any single character b?lk matches balk or bulk* Zero or more characters *or matches door, floor, and matador

or* matches ordinary, order, and organize*or* matches bored, category, and fluoride

# Any single digit 6#4 matches 604, 644, and 664

Page 24: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.22 Query using a wildcard in its criteria.

query design

Wildcard criterion: Like "*choc*"

dynaset

Page 25: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.23 Formatting a query's calculated column.

Page 26: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.24 Query design and dynaset with calculated column.

expression

query design

dynaset

Page 27: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.25 Access aggregate functions.

Function MeaningAvg Computes a field’s average value (ignores null fields)Count Counts the number of non-null (empty) items in a fieldMax Computes largest value in a fieldMin Computes smallest non-null value in a fieldSum Computes the total of all items in a fieldStDev Computes the standard deviation of non-null values in a fieldVar Determines the variance of non-null values in a field

Page 28: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.26 Sorted sales totals for each employee created withthe Sum aggregate function.

expressions

Total row

total sales

concatenated fields form a single name

Page 29: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.27 Creating an outer join.

click for outer join

Page 30: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.28 Using “Is Null” to display rows with empty fields.

outer join lines are arrows

empty cells indicate no sales

Page 31: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.29 A parameter query design and run-time prompt.

enter criteria

parameter in criteria row of QBE grid

Page 32: FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan

Figure 4.30 A parameter query dynaset.