Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review of Main Database Features

Similar presentations


Presentation on theme: "Review of Main Database Features"— Presentation transcript:

1 Review of Main Database Features
-- Relationship Editor -- Query by Example Grid -- And/Or Logic -- Sort -- Total Query -- Sum, Average, Count, Max -- Group By, Where -- Expression Builder -- Inner/Outer Joins

2 Relationship Editor The relationship editor is used primarily when you are planning the query, i.e., identifying the tables that contain data that must be included in the query and the bridge tables that connect the tables containing the data.

3 Relationship Editor In this query, fields are drawn from the Brides and Product tables. Here are two versions of the query, the first wrongly formed because the bridge table that connects the Brides and Product tables was not included, the second properly formed because the bridge makes it possible to know which product goes with which bride.

4 Query By Example Grid -- Post Tables -- Select Fields from Tables
-- Sort fields alphabetically or numerically -- Set criteria for selecting records using AND or OR logic -- AND operates horizontally, e.g., a record must be Condy AND 22517 to be selected or Blather AND -- OR operates vertically. All persons named Jilbert will be selected (regardless of their zip code since there is no zip AND) along with Condy and Blather.

5 Total Query: 1 -- Total Query opened with sigma: ∑
-- Adds to query by example grid a TOTAL row that combines values in a single field. -- Values in the field can be combined by adding them all up, SUM, by calculating their average, AVG, by counting up the number of records, COUNT, or by identifying the largest, MAX, or smallest, MIN value.

6 Total Query: 2 -- The GROUP By and WHERE options in a
TOTAL query can be used to aggregate subsets of records, e.g., just the Flower and Food records. -- GROUP BY creates a separate record for each value found in the GROUP BY field, i.e., for Flowers and Food in the example. GROUP By can be used with or without criteria. When there are no criteria, subtotals are reported for all values in the field, i.e., the query would yield subtotals for Apparel, Venue, Food, Flowers, and Musicians since those five values exist in that field. -- WHERE is used only with criteria and only when there is more than one value in the criteria rows. It selects all records that meet the criteria, but then treats them as one big group with only one average or summed value. Result Result

7 Expression Builder: -- Expression Builder opens
with the magic wand icon. It is like a piece of paper on which formulas may be written--but you don’t have to write the values. You can just point and click to post them on the writing slate. Expression builder is used to carry out some operation on two or more fields to create a new calculated value. Formulas are standard math. Nothing special. (Quantity x Price) x FindFee

8 Inner Versus Outer Joins:
The join type determines which records will be reported when a query is run. When an INNER join connects two tables, records are reported only if there are values (a primary key value and a matched foreign key value) in both tables. When a LEFT OUTER join connects the tables, all records in the primary table (table on the 1side of the 1 to ∞ relationship) are reported. Only matched records (records with a foreign key value) in the related table (table on ∞ side) are reported. When a RIGHT Outer join connects the tables, all records in the related table (∞ side) are reported. Only matched records in the primary table are reported. -- The join type is specified in this menu. Note that the effects of establishing each join type are described. Option 1 is an INNER join, option 2 a LEFT OUTER and option 3 a RIGHT OUTER join.

9 Joins and their results are shown below. Note
that every vendor is matched with a product in the inner join. The left outer join reports all vendors (including 2 with no product). The right outer join reports all products (including 2 that have no associated vendor). INNER JOIN LEFT OUTER JOIN RIGHT OUTER JOIN

10 Your Task: Match Database Features with the Business Problem
-- Calculate the amount of tax your firm owes the state in the current year. -- Your dealership sells three different kinds of sports car. What is overall average amount that has been spent by people who bought a sports car? -- Send a thank you card to customers who, in the last month, spent $500 or more on shoes or $1000 or more on a dress at your store. -- Identify all the suppliers listed in your supplier table from whom you have never purchased a product. Delete them from the table. -- Determine how many purchases were been paid for by Master Card, American Express Card, Visa, or cash during December last year. -- What percentage of your overall sales did you pay to the credit card companies in fees last year. -- Run a query to identify the people who are your best customers—i.e., those from whom you have earned the most money. Flag them in the database so staff will bend over backwards to take good care of them.


Download ppt "Review of Main Database Features"

Similar presentations


Ads by Google